Running React Native app using stock Google emulator
I always used iOS emulator for running my React Native project. When I tried to test my app in Android device, I found it hard to install and run the app. I could not find clear instructions on how to install the emulator using Android studio and after installing it, I faced few problems before running my app in the emulator. Here is the easy way to install an emulator using Android studio and to run your app in the emulator.
Download and Install Android studio from https://developer.android.com/studio/index.html. This will also install Android sdk in your machine. By default, sdk is installed in /Library/Android/sdk/, but you can change the installation path.
If there is some dependency that has to be installed, Android studio is intelligent enough to find that and make you install it in an easy way possible. When you open an existing project, it will show those installations in the messages section which is just one click to install.
Select Tools -> AVD Manager. Then select ‘Create Virtual Device’, choose the emulator you want to install and install it. You have to download the required API’s before installing the emulator. Android studio will show download option for those API’s after you choose the emulator.
Navigate to the project and run react-native run-android in the terminal and see the app running in the emulator.
Make sure to set environment variable ANDROID_HOME (path to android sdk) and JAVA_HOME (path where java is installed) in your bash profile, before building your app.
