How to set ANDROID_SDK_ROOT in mac?

android, android-emulator, cordova, macos

Solution

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

Problem

I am trying to use Cordova for mobile 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 successful’ 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: ``` 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 ```

Original source

Related problems