1

I am new in phonegap. I am getting error when I add android in phonegap. I have used this steps to solve this error but I am still getting this error:

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

/Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:126 
throw e; 
^ 
Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path. 
at /Users/ss/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29 
at _rejected (/Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24) 
at /Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30 
at Promise.when (/Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31) 
at Promise.promise.promiseDispatch (/Users/sss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41) 
at /Users/ss/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44 
at flush (/Users/ss/.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)
Community
  • 1
  • 1
Sport
  • 8,570
  • 6
  • 46
  • 65

3 Answers3

1

You have to add /pathToAndroidFolder/sdk/platform-tools and /pathToAndroidFolder/sdk/tools to your $PATH

steps for Mac OSX: edit your .bash_profile using nano or any other editor

nano ~/.bash_profile

add this line

export PATH=${PATH}:/Users/ss/Documents/Software/adt-bundle-mac-x86_64-20130729/sdk/tools:/Users/ss/Documents/Software/adt-bundle-mac-x86_64-20130729/sdk/platform-tools

open a new terminal window to make it work, or use this command to make it work on the curren terminal window:

source ~/.bash_profile
jcesarmobile
  • 51,328
  • 11
  • 132
  • 176
  • in which SO do you develop? do you know what is the $PATH variable? – jcesarmobile Jan 13 '14 at 08:42
  • hello2 ss$ PATH /Users/ss/Documents/Software/adt-bundle-mac-x86_64-20130729/sdk/platform-tools -bash: PATH: command not found i am doning like this – Sport Jan 13 '14 at 08:46
  • in which SO do you develop? – jcesarmobile Jan 13 '14 at 08:53
  • MacBook Pro , i am using – Sport Jan 13 '14 at 09:02
  • I've added the steps for Mac OSX – jcesarmobile Jan 13 '14 at 09:02
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/45100/discussion-between-sport-and-jcesar) – Sport Jan 13 '14 at 09:11
  • I have this and still the same error. export HOME="/Users/rover" export ANDROID_SDK="$HOME/Documents/Dev/Android/adt-bundle-mac-x86_64-20140702/sdk" export ANDROID_HOME="$ANDROID_SDK/tools" export ANDROID_PLATFORM_TOOLS="$ANDROID_SDK/platform-tools" export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$ANDROID_SDK/build-tools:$PATH" export ANT_HOME="/usr/local/bin/ant" #export PATH="$PATH:$ANT_HOME/bin" $ which ant /usr/local/bin/ant $ ls /usr/local/bin/ant /usr/local/bin/ant $ ant -v Apache Ant(TM) version 1.9.4 $ cordova --version 4.0.0 error is: node_modules/q/q.js:126 throw e; – mylord Nov 06 '14 at 15:10
0

There is step-by-step instructions on the PhoneGap Doc'.you can use this to solve the issue link

square
  • 162
  • 2
  • 13
0

For OSX your path needs to include /Users/yourusername

their example: /Development/adt-bundle/sdk/platform-tools needs to be: /Users/yourusername/Development/adt-bundle/sdk/platform-tools

check your path with echo $PATH (use caps, it's case sensitive!)

K00kykelly
  • 31
  • 3