Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set ANDROID_SDK_ROOT in mac?

I am trying to use Cordova for app development. For now I am focusing on Android. I am trying to run cordova emulate android. It runs and after a long list of packages it says ‘build sucessful’ but in the end it also says

PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT

I use Homebrew. Here is output of the command on the command line:

BUILD SUCCESSFUL  Total time: 1.345 secs Built the following apk(s):     /users/mayurtolani/myMobileApp/platforms/android/build/outputs/apk/android-debug.apk  ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home No emulator specified, defaulting to Nexus_5_API_24 Waiting for emulator to start... PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT 
like image 420
Mayur Tolani Avatar asked Oct 25 '16 19:10

Mayur Tolani


People also ask

Can you develop Android on Mac?

Installing Android StudioDownload Android Studio for MAC from the https://developer.android.com/studio/index.html#downloads. Follow the steps to install the application in OSX. On first start, Android Studio will try to download the Android SDK.

What is my Android_home?

ANDROID_HOME is usually a directory like . android . Its where things like the Debug Key will be stored. According to David Turner on the NDK Mailing List, both ANDROID_NDK_ROOT and ANDROID_SDK_ROOT need to be set because other tools depend on those values (see Recommended NDK Directory?).

Where is Android SDK Macos?

The default path of Android SDK is /Users/<username>/Library/Android/sdk , you can refer to this post. Then save the file.


2 Answers

vim ~/.bash_profile 

Then add the following environment variables:

export ANDROID_HOME=~/Library/Android/sdk export ANDROID_SDK_ROOT=~/Library/Android/sdk export ANDROID_AVD_HOME=~/.android/avd 

Android path might be different, if so change it accordingly. At last, to refresh the terminal to apply changes:

source ~/.bash_profile 
like image 88
renatodamas Avatar answered Sep 22 '22 13:09

renatodamas


Since you used Homebrew, you can add this to your path:

export ANDROID_SDK_ROOT=/usr/local/share/android-sdk 

Hope I helped! :D

like image 28
Rodrigo Chaves Avatar answered Sep 22 '22 13:09

Rodrigo Chaves