Reputation: 3852
I am new to Cordova and phonegap but have Android working on my ubuntu 12.04. I followed this official guide and manage to install cordova.
Despite my machine supports android sdk, when I run this command:
cordova platform add android
I get the following exception:
*cordova platform add android
Creating android project...
/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at /root/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29
at _rejected (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
at /root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
at Promise.when (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
at /root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
at flush (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: /root/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:112: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)
root@sergio-Aspire-5755G:/home/sergio/Development/HelloWorld# cordova platforms ls
Installed platforms:
Available platforms: android, blackberry10, firefoxos, ubuntu
root@xxx-Aspire-5755G:/home/sergio/Development/HelloWorld# cordova platform add android
Creating android project...
/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at /root/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29
at _rejected (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
at /root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
at Promise.when (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
at /root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
at flush (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: /root/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:112: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 tried and see other post like this but noone helped me.
Android sdk version 19 is installed
Upvotes: 0
Views: 2655
Reputation: 1280
You need to check if path to Android SDK is correct or not.
Check your Environment Variables PATH, ANDROID_PLATFORM_TOOLS, ANDROID_HOME, ANT_HOME you can check if they are configured correctly by echo %ANDROID_HOME%
check for all Paths you will know which path is not configured properly.
Upvotes: 1
Reputation: 3852
I solved this way:
adding the below line to my .bashrc:
export PATH=$PATH:/opt/adt-bundle-linux-x86_64-20131030/sdk/platform-tools:/opt/adt-bundle-linux-x86_64-20131030/sdk/tools
Upvotes: 0
Reputation: 238
1) run "android avd" command and create at least one virtual device based on a version of a previously downloaded SDK.
2) sudo apt-get install ant1.8
worked for me.
Upvotes: 1