第一次执行Cordova build android失败原因一则

                       

执行结果显示:
Running command: cmd “/s /c “D:\Kapsel_Projects\HelloWorld\platforms\android\cordova\build.bat””
[Error: Please install Android target: “android-22”.

Hint: Open the SDK manager by running: C:\Users\Administrator\AppData\Local\Android\Sdk\tools\android.BAT
You will require:
1. “SDK Platform” for android-22
2. “Android SDK Platform-tools (latest)
3. “Android SDK Build-tools” (latest)]
ERROR building one of the platforms: Error: cmd: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 2
    at ChildProcess.whenDone (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:827:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

大概就是说Android SDK环境有问题,下面三个东东只是少一个。
1. “SDK Platform” for android-22
2. “Android SDK Platform-tools (latest)
3. “Android SDK Build-tools” (latest)]

我的环境是Android Studio,在tools菜单里面安装SDK 2.2嘛
Android_HOME环境变量也是指到了正确的SDK目录

稍后,找到Android_HOME所在目录,执行SDK Manager.exe,在界面中却发现  没有android-22 SDK!!!!

马上在SDK Manager.exe界面里面安装android-22 SDK。

回到命令行执行Cordova build android成功。

估计Android Studio的SDK目录或者环境,还是和我命令行Android_HOME所在目录里面的SDK内容有差异。

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

猜你喜欢

转载自blog.csdn.net/gddghtd/article/details/86539499