Setup React Native Project Android on Mac
I am writing this article as during React Native Android Project setup on Macbook I faced some challenges. Hence I thought to create an article to help some other developer solve some very common issue during the setup of project.
Reference Link: https://reactnative.dev/docs/set-up-your-environment
Step 1: Install Node (If not install), Watchman
For installing Watchman (brew install watchman)
Step 2: Install JDK
brew install — cask zulu@17
Now check if zulu@17 is installed at this directory (/Library/Java/JavaVirtualMachines)
Now add this path:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
Step 3: Now download and install android studio from here (https://developer.android.com/studio/index.html)
During installation keep all default settings, no need to change anything.
Step 4: Configure the ANDROID_HOME environment variable
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
Note: Run source ~/.zprofile (or source ~/.bash_profile for bash) to load the config into your current shell. Verify that ANDROID_HOME has been set by running echo $ANDROID_HOME and the appropriate directories have been added to your path by running echo $PATH.
Step 5: Now check available list of devices using the following command (emulator -list-avds )
Step 6: If no device is available then create a new device from the android studio.
Additional steps:
If you find this issue (The error zsh: command not found: emulator indicates that the Android SDK’s emulator tool is not in your system’s PATH, so your terminal (Zsh) cannot locate the command. Here’s how to resolve this by adding the Android SDK tools to your PATH.)
Step 7: Now add Android path using the following command (nano ~/.zshrc) and add below lines at the end of file.
# Add Android PATH for scription
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/platform-tools
If you find this issue (Android can not connect to metro still metro is running)
Step 8: adb reverse tcp:8081 tcp:8081
After doing change either in step 6 or 7 you need to restart the terminal again.
Thank you for going through the article. If you are looking for any assistance related to Html, css, React, React Native, Next.js, Node.js, GraphQl, Python, Flask, Panda. Please let me know. I will be glad to help you.
To tell us about your concern please fill the form: https://docs.google.com/forms/d/1uh343ab8uwVhCpozi_etFyV67f6zVoIiMlrYKLwOgnE/prefill or visit and mail your concern by visiting my blog page.