Windows 上的 Ionic:已安装 Android SDK.仍然得到“错误:请安装Android目标:“android-22"; [英] Ionic on Windows: Android SDK installed. Still get "Error: Please install Android target: "android-22"
问题描述
我已经设法打破了我以前工作的 Ionic 环境版本.例如:我下载演示项目sidemenu"并运行ionic platform add android"没有任何问题.当我尝试运行ionic build"时,我收到以下消息:
I have managed to break my previously working version of the Ionic enviroment. For example: I download the demo project "sidemenu" and run "ionic platform add android" without any problem. When I try to run "ionic build" I get the following message:
$ ionic build
Running command: "c:Program Files
odejs
ode.exe" h:gitAbsoluthooksafter_p
repare 10_add_platform_class.js h:/git/myapp add to body class: platform-android
Running command: cmd "/s /c "h:gitAbsolutplatformsandroidcordovauild.bat"
"
[Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running: c:Users
icsjAppDataLocalAndroidandroid-sdk oolsandroid.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
icsjAppDataRoaming
pm
ode_modulesco
rdova
ode_modulescordova-libsrccordovasuperspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
我不明白是什么导致了错误消息,因为已经安装了 android-22.我也有 SDK 平台工具和构建工具.他们在 PATH 上:
I don't understand what causes the error message since android-22 is already installed. I have the SDK Platform-tools and build-tools as well. They are on the PATH:
.../c/Program Files (x86)/Java/jdk1.7.0_71/bin:/c/Users/nicsj/AppData/Local/Android/android-sdk/tools:/c/Users/nicsj/AppData/Local/Android/android-sdk/build-tools/22.0.1:/c/Users/nicsj/AppData/Local/Android/android-sdk/platform-tools
离子设置:
Cordova CLI: 5.1.1
Gulp version: CLI version 3.9.0
Gulp local:
Ionic CLI Version: 1.6.4
Ionic App Lib Version: 0.3.8
OS: Windows 7 SP1
Node Version: v0.12.5
安卓 SDK:
C:Users
icsj>android list targets
Available Android targets:
----------
id: 1 or "android-22"
Name: Android 5.1.1
Type: Platform
API level: 22
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 2 or "android-23"
Name: Android 6.0
Type: Platform
API level: 23
Revision: 1
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
这个问题是新的,我不知道是什么原因造成的.关于我应该去哪里看的任何建议?
This problem is new and I don't know what caused it. Any advice on where I should look?
推荐答案
首先,很抱歉我的英语不好.我刚刚遇到了同样的问题,我通过更改目标来解决它:
First of all, sorry for my dummy english. I just had the same problem and I fix it changing the target:
# Project target.
target=android-22 (I had set this to android-23)
这应该在两个文件中完成:
This should be done in two files:
yourApp/platforms/android/project.properties
yourApp/platforms/android/CordovaLib/project.properties
还应更新清单:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
这篇关于Windows 上的 Ionic:已安装 Android SDK.仍然得到“错误:请安装Android目标:“android-22";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!