There are many questions here regarding problems running "cordova add platform android" command. I've tried each purposed solution and none have helped me.
Error message:
~/sandbox/hello$ cordova platform add android
Creating android project...
/home/acras/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:126
throw e;
^
Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.
at /home/acras/.cordova/lib/android/cordova/3.5.0/bin/lib/check_reqs.js:80:29
at _fulfilled (/home/acras/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/acras/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/acras/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:760:13)
at /home/acras/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:574:44
at flush (/home/acras/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: /home/acras/.cordova/lib/android/cordova/3.5.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135: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)
I did what the error message tells me (run android and installed all packages) but the error persists.
PATH: Android SDK home, tools and platform-tools are in the path
In the platforms folder inside android sdk I have only android-20 and android-L folders.
I guess if I add android-19 OR make cordova want android-20 will solve my problem. What should I do to achieve both options?
Thank you
The current Cordova (4.1.2) only wants to build against API v19
> cordova build android
Running command: /Users/Duncan/Documents/Work/rescyoume/cordova/platforms/android/cordova/build
[Error: Please install Android target "android-19".
Hint: Run "android" from your command-line to open the SDK manager.]
To install v19, run android as it suggests and then, in the GUI that opens, select Android 4.4.2 (API 19)/SDK Platform in the tree and click the Install packages... button.
You need to download Android 4.4.2(API 19) because target API is set to 19 in android manifest file. Either change it to the API that you have already downloaded or download API 19
In terminal type the command
$ android
this will open the Android SDK manager.
Check the API 19 SDK Platform checkbox and download it.
Now when you type command
$ cordova platform add android
should work fine.
If are you using Linux,
Install ant:
sudo apt-get install ant
Export the correct sdk path:
export PATH=${PATH}:/<sdk path>/sdk/platform-tools:/<sdk path>/sdk/tools
Related
C:\Users\GINOM HANGSHING\hello>cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
cmd: Command failed with exit code 1 Error output:
'android' is not recognized as an internal or external command,
operable program or batch file.
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin\gradle
Error: Some of requirements check failedenter image description here
Try to update your android platform by
C:\Users\GINOM HANGSHING\hello>cordova platform update android --save
Add System variable, Path. Add "\tools" directory (in addition of "\platform-tools") of your Android SDK folder. There "android.bat" is located.
Restart any open terminals.
How to check Android SDK folder: Android SDK location
If you do not find a \tools folder in your Android SDK folder, you can either try reinstalling your Android SDK or downloading and extracting the tools without the IDE from the links below (Be sure to have read and agreed with the terms of service before downloading any of the command line tools)
Windows no installer: https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip
MacOSX: https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip
Linux: https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
This is how I solved the issue on my machine.
(Deepin 20 community)
After updating my android platform by running the following commands:
cordova platform rm android
and
cordova platform add android
I configured my environment variables and path as follows:
export ANDROID_SDK_ROOT="path-to-android-studio/Sdk"
export JAVA_HOME="/usr/lib/jvm/jdk1.8.0_301/"
export PATH="$PATH:$ANDROID_SDK_ROOT/platform-tools"
export PATH="$PATH:$ANDROID_SDK_ROOT/tools"
export PATH="$PATH:$ANDROID_SDK_ROOT/tools/bin"
export PATH="$PATH:$ANDROID_SDK_ROOT/emulator"
That solved the problem
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
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
I am trying to create my first android project using cordova on my Windows 7 machine. I have installed latest Android SDK and cordova. I have set path for ANDROID_PATH, ANDROID_PLATFORM_TOOLS, ANDROID_TOOLS and ANT_HOME.
Using directions from http://cordova.apache.org/docs/en/3.6.0//guide_cli_index.md.html#The%20Command-Line%20Interface I have created the "hello" project but as I try to add android platform using:
cordova platform add android
from my command prompt android emulator opens up showing android home screen, so I can navigate through the OS but soon as close it I get the output:
C:\devCenter\private\hello>cordova platform add android
Creating android project...
C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:126
throw e;
^
Error: Please install Android target "android-19".
Hint: Run "android" from your command-line to open the SDK manager.
at C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\lib\check_reqs.js:173:19
at _fulfilled (C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:7
at C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:574:44
at flush (C:\Users\think ahead\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\think ahead\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
C:\devCenter\private\hello>
There is no android directory created inside platforms in "hello" project. Can someone please help me in pointing what I am missing/doing wrong.
EDIT:
I have updated SDK with API-19 but I still getting the same problem. Is there anything else I have to do?
Run the SDK Manager.exe from your /android-sdk/ folder and make sure you install the
SDK Platform for Android 4.4.2 (API 19). Once that is done you just rerun the cordova command.
From folder ADT-x86 (your SDK) run SDK manager.exe, then you search Android 4.4.2 (API 19). check it! and you press install, before that you need to accept license agreement first, it was help me to solve that matter, hope this help :)
I have downloaded android studio, installed ant, node.js, cordova and jdk
But I can not add platform to my cordova android app
Here is the bashrc file:
JAVA_HOME=/usr/lib/jvm/jdk1.8.0
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH
export PATH=${PATH}:/home/Dev/android-studio/sdk/tools
export PATH=${PATH}:/home/Dev/android-studio/sdk/platform-tools
Whenever I try to add platform under my created app project it throws error:
Creating android project...
/home/anupam/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at /home/anupam/.cordova/lib/android/cordova/3.5.1/bin/lib/check_reqs.js:87:29
at _rejected (/home/anupam/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:808:24)
at /home/anupam/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:834:30
at Promise.when (/home/anupam/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/home/anupam/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:752:41)
at /home/anupam/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:574:44
at flush (/home/anupam/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: /home/anupam/.cordova/lib/android/cordova/3.5.1/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
I an tired of searching all the answers in stackoverflow and google. Not a single guide could solve my problem. Just one thing I want to use ANdroid studio, not eclipse. SO please do not mention eclipse workarounds. If there is any clean install method , please mention if needed.
I had a similar issue - if you have eclipse installed prior your cordova installation, then you probably don't have the latest API updates.
Run android from your command line to open your SDK Manager - or find it in your android installation root folder (for CLI - Use Administrator) - or simply from your eclipse UI command.
In here find where updates are needed and install and run your android installation as you did before cordova platform add android