Install React Native for Android

Follow these steps to install react native for Android:

Step 1

Open Terminal.app and add following

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 

If above link doesn’t work get new link from Homebrew

Step 2

brew install node 

Step 3

brew install watchman 

Step 4

Install JDK

brew cask install adoptopenjdk/openjdk/adoptopenjdk8 

Step 5

Download and Install Android Studio

Step 6

Install the Android SDK
Requirements – Android 9 (Pie) or higher
Requirements – Android SDK Platform 28 or higher

Step 7

Setup ANDROID_HOME environment variable

Open Terminal > vi .bash_profile
Add below lines

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools 

To save type :wq and enter

Step 8

cd Desktop/
npx react-native init reactFirstApp 

Run your AVD Emulator from Android Studio and close Android Studio. Keep emulator running

Step 9

Go to folder created

cd reactFirstApp 

Step 10

Running React Native application

npx react-native start 

Step 11

Run Packager – Android simulator – use different terminal

Step 12

npx react-native run-android 

This will take few minutes to execute