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
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)
I am having a tremendous problem with cordova. For some reason, the command cordova build gives me the following error and I cannot figure out why. I try to do a simple andoid application on Windows 7.
C:\Users\User\Documents\Cordova\workshop>cordova build
Running command: cmd "/s /c "C:\Users\User\Documents\Cordova\workshop\platforms\
android\cordova\build.bat""
[Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running: C:\Users\User\AppData\Local\Android\sdk\t
ools\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\User\AppData\Roaming\npm\node_modules\cor
dova\node_modules\cordova-lib\src\cordova\superspawn.js:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
C:\Users\User\Documents\Cordova\workshop>
Do you have any advice how to solve this problem?
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'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