I'm trying to build an Android app using inonic build android but I have the following error:
running cordova build android
Running command: "c:\Program Files\nodejs\node.exe" c:\xampp\htdocs\discipulado\
discipulado\hooks\after_prepare\010_add_platform_class.js c:/xampp/htdocs/discip
ulado/discipulado
add to body class: platform-android
Running command: c:\xampp\htdocs\discipulado\discipulado\platforms\android\cordo
va\build.bat
[Error: Please install Android target: "android-21".
Hint: Open the SDK manager by running: C:\Users\Thiago\AppData\Local\Android\sdk
\tools\android.BAT
You will require:
1. "SDK Platform" for android-21
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
ERROR building one of the platforms: Error: c:\xampp\htdocs\discipulado\discipul
ado\platforms\android\cordova\build.bat: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: c:\xampp\htdocs\discipulado\discipulado\platforms\android\cordova\build.b
at: Command failed with exit code 2
at ChildProcess.whenDone (c:\Users\Thiago\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\src\cordova\superspawn.js:131: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)
I already installed Apache Ant, but the error remains. I removed the Android platform with ionic platform remove android and added with ionic platform add android with no success.
Any idea?
UPDATE
I already installed Android Studio and Android SDK Tools.
As the error suggests, your system needs to install "android-21", which is Android 5.0 Lollipop
Related
enter image description here
user#admin-HP-Pavilion-g6-Notebook-PC:~/myapp$ cordova run androidRunning command: /home/user/myapp/hooks/after_prepare/010_add_platform_class.js /home/user/myapp
add to body class: platform-android
Running command: /home/user/myapp/platforms/android/cordova/run
ERROR: Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running: /home/user/Android/android-sdk-linux/tools/android
You will require:
"SDK Platform" for android-22
"Android SDK Platform-tools (latest)
"Android SDK Build-tools" (latest)
ERROR running one or more of the platforms: Error: /home/user/myapp/platforms/android/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
Error: Error executing "google-chrome --user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova http://localhost:8000/index.html": /bin/sh: 1: google-chrome: not found
at /home/user/myapp/platforms/browser/cordova/node_modules/cordova-serve/src/exec.js:34:26
at ChildProcess.exithandler (child_process.js:758:5)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Socket.<anonymous> (child_process.js:1183:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:485:12)
ERROR running one or more of the platforms: Error: /home/user/myapp/platforms/browser/cordova/run: Command failed with exit code 1
You may not have the required environment or OS to run this project
Run (this is specific to your error, path may vary for others)
/home/user/Android/android-sdk-linux/tools/android
Verify that the following are currently installed:
"SDK Platform" for android-22
"Android SDK Platform-tools (latest)
"Android SDK Build-tools" (latest)
Using Linux, I run the command:
cordova build
and get the following:
[Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running:
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: /var/programming/projects/hello/platforms/android/corda/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /var/programming/projects/hello/platforms/android/cordova/build: Command failed with exit ce 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/corva/superspawn.js:139: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)
I am running everything as "root" user and have the required environmental variables set.
P.S.
I followed this guide:
https://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html
I'm using Cordova 5.1 and when i ran cordova emulate android i get this error :
Running command: cmd "/s /c "c:\Users\Soheil\Desktop\phoneGap\hello\platforms\an
droid\cordova\run.bat --emulator""
ERROR: Error: Please install Android target: "android-18".
Hint: Open the SDK manager by running: C:\Program\ Files\ (x86)\Android\android-
sdk\tools\android.BAT
You will require:
1. "SDK Platform" for android-18
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)
Error: cmd: Command failed with exit code 2
at ChildProcess.whenDone (C:\Users\Soheil\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\src\cordova\superspawn.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)
here's my sdk manager :
Any idea ? Thanks
The problem is, that according to your screenshot you have installed Android 4.1.2 (API 16) but your program requires Android 4.3 (API 18). If you download the appropriate files you should be good to go.
i have installed cordova on linux mint 17.1 xfce, jdk and android and npm is ok and i can create new cordova application and add android platform to it :
cordova create ...
cordova platform add android ..
but when i want to build android i get a error :
cordova build ...
Running command: /home/nasser/Desktop/app/app01/platforms/android/cordova/build
ANDROID_HOME=/home/nasser/android/sdk
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
Running: /home/nasser/Desktop/app/app01/platforms/android/gradlew cdvBuildDebug -b /home/nasser/Desktop/app/app01/platforms/android/build.gradle -Dorg.gradle.daemon=true
FAILURE: Build failed with an exception.
* Where:
Script '/home/nasser/Desktop/app/app01/platforms/android/CordovaLib/cordova.gradle' line: 64
* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Please install the Android build tools version 19.1.0 or higher.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 20.222 secs
/home/nasser/Desktop/app/app01/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/nasser/Desktop/app/app01/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/nasser/Desktop/app/app01/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/nasser/Desktop/app/app01/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /home/nasser/Desktop/app/app01/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
what i can do ?
Once you installed the android sdk, configured ANDROID_HOME and updated the path, you have to run the androidcommand to actually download the sdk tools and android platform.
You don't need to download everything. You can uncheck the system images (keep one if you want to use the emulator), the samples, the sources of android, the docs and android apis older than API 22 (latest android cordova version 4 requires api 22).
Not sure if you still need to install ant with android cordova 4, as it seems they switched to graddle wich is installed automatically.
I had the same problem, and this is the solution for the problem referent to:
No installed build tools found. Please install the Android build tools
version 19.1.0 or higher.
1) You have to go to the android sdk tools folder, for example (in my case) I just wrote the command in my console: $ cd android-sdk-linux/tools
2) Inside this folder you have to write the command
$ ./android list sdk --all and after
$ ./android update sdk -u -a -t 20
And that's all! :)
This will install all the tools you need as well as the system images which are quite large, limit them using the --filter flag
android update sdk --no-ui --all
I'm on Ubuntu, I installed cordova, cordova cli, android studio and all the packages but when I try to build my app I recive the following error:
Running command: /home/admin/Desktop/hello/platforms/android/cordova/build
[Error: Please install Android target: "android-21".
Hint: Open the SDK manager by running: /opt/android-sdk/tools/android
You will require:
1. "SDK Platform" for android-21
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
ERROR building one of the platforms: Error: /home/admin/Desktop/hello/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/admin/Desktop/hello/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
Note: I added the path for android-sdk in bashrc:
#AndroidDev PATH
export PATH=${PATH}:${HOME}/android-sdk-linux/tools
export PATH=${PATH}:${HOME}/android-sdk-linux/platform-tools
You are having this issue right!! https://stackoverflow.com/questions/29062330/error-install-android-target-cordova-cli
Update your SDK tools & "SDK build" tools in Android SDK. With Eclipse ADT it looks like this image
Install the 21 package as your version of cordova is expecting package 21