Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova platform add android error

Using ubuntu 12.04

cordova platform add android
Creating android project...

/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error: An error occured during creation of android sub-project. 

/home/admin/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at /home/admin/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:87:29
    at _rejected (/home/admin/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
    at /home/admin/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30
    at Promise.when (/home/admin/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/home/admin/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)
    at /home/admin/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44
    at flush (/home/admin/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)

    at /usr/local/lib/node_modules/cordova/src/platform.js:244:30
    at ChildProcess.exithandler (child_process.js:641:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

What am I doing wrong?

like image 253
Derek Avatar asked Jan 03 '14 05:01

Derek


1 Answers

I was having what looks like the same problem. Make sure you add the ADT tools and platform-tools to your system path; doing this fixed the problem for me. Go to your .bashrc file (in your home directory) and add something like:

export PATH=${PATH}:/your-path/android-sdk-linux/platform-tools:/your-path/android-sdk-linux/tools

Then restart your session or do $ source .bashrc to enable the changes. Now cordova should be able to create the Android project just fine.

like image 188
jloubert Avatar answered Sep 23 '22 00:09

jloubert