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
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.
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?).
The default path of Android SDK is /Users/<username>/Library/Android/sdk , you can refer to this post. Then save the file.
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
Since you used Homebrew, you can add this to your path:
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
Hope I helped! :D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With