Android SDK on mac for ionic


#1

Hi guys,

First I’d like to congratulate all ionic team for this awesome frawemork, it has been a while that I wanted to work on hybrid apps now my dream becomes true :smile:

I’ve been developing and testing on iPhone for the past few weeks and everything is going very well. But my issue is that I didn’t succeed in testing on android.
I download the sdk as per ionic guides.
I extracted the files in a folder I renamed “android” in my applications folder.
sudo touch ~/.bash_profile; open ~/.bash_profile
I added this line to the empty file : export PATH=${PATH}:~/Applications/android/sdk/platform-tools:~/Applications/android/tools

When I do a ionic platform android I got : 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.

Can someone please help me on this ?

Thank you in advance !


#2

I would check that android command works from CLI. It should open SDK Manager. (Also verify adb , … ). If no - check global parameters once more. Sounds like its not Ionic issue.

Just for reference:
echo $PATH gives me:

/opt/adt-bundle-mac/sdk/tools:/opt/adt-bundle-mac/sdk/platform-tools:/opt/adt-bundle-mac/android-ndk-r9

#3

Not really an ionic issue…

http://cordova.apache.org/docs/en/3.4.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide


#4

Hi,

Thanks for your reply, I get this : /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Applications/android/sdk/platform-tools:/Applications/android/tools:/Applications/android/sdk/platform-tools:/Applications/android/tools/android:/Users/remythellier/Applications/android/sdk/platform-tools:/Users/remythellier/Applications/android/tools:/Applications/android/sdk/platform-tools:/Applications/android/tools

I don’t think it is an ionic issue either just I don’t know how to make it works…


#5

Its a bit strange what you have:

Applications/android/sdk/platform-tools:
/Applications/android/tools:
/Applications/android/sdk/platform-tools:
/Applications/android/tools/android:
/Users/remythellier/Applications/android/sdk/platform-tools:
/Users/remythellier/Applications/android/tools:
/Applications/android/sdk/platform-tools:
Applications/android/tools

I see platform-tools x 4 times , hmmm

please left only platform-tools and tools, all other duplicates - remove


#6

Hi again,
now I have only :
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Applications/android/sdk/platform-tools:/Applications/android/tools

But I still have the same issue :confused:


#7

To be even more precise I have this error after a ionic platform android :

Running platform task…
Adding platform android
Creating android project…

/Users/remythellier/.cordova/lib/android/cordova/3.4.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/remythellier/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/remythellier/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
at /Users/remythellier/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/remythellier/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/remythellier/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
at /Users/remythellier/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
at flush (/Users/remythellier/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: /Users/remythellier/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Unable to add platform android. Please see console for more info.


#8

Well sorry guys I found my issue my path wasn’t correct. Thanks a lot !