Setting up an Android Virtual Device on Android Studio
Install Android Studio with standard installation.
- If you’re on Mac or Linux, there’s an additional step to follow.
Open Android Studio -> Configure -> SDK Manager -> You’ll be able to see the SDK Path
Open ~/.bash_rc or ~/.bash_profile and export ANDROID_SDK_ROOT variable and add it to the PATH as well.
- If you’re on Mac, you will need to add platform-tools to thePATH
platform-tools location : android-sdk-path/platform-tools
Also, need to verify whether the JAVA_HOME variable is set. If it is not set, once you run the react-native run-android, it will give the below error.
':app:compileDebugJavaWithJavac'.
> Could not find tools.jar
For Mac, JAVA_HOME location will be something like below
/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home
Then try to run adb on the terminal to verify the setup
To add a virtual device
Open Android Studio -> Configure -> AVD Manager -> Create Virtual Device -> Choose a device to install and the preferred Android OS version for the device