This post goes over how to fix React Native doctor errors for Android on macOS:
Errors
Run:
npx react-native doctor
To see the possible Android errors:
Android
✖ JDK
✖ Android Studio - Required for building and installing your app on Android
✖ Android SDK - Required for building and installing your app on Android
- Versions found: N/A
- Version supported: 31.0.0
✖ ANDROID_HOME
JDK
Follow the React Native documentation to install the Java Development Kit:
brew install --cask zulu11
Or download JDK from Oracle.
Android Studio
Follow the React Native documentation to set up the Android development environment.
Android SDK
Follow the React Native documentation to Install Android SDK.
Versions found: N/A
Install Android SDK Command-Line Tools and append the PATH
in your config file:
export PATH=$PATH:$HOME/Library/Android/sdk/cmdline-tools/latest/bin
Version supported
Go to android/build.gradle
and set buildToolsVersion
to the version you’re using:
buildscript {
ext {
- buildToolsVersion = "31.0.0"
+ buildToolsVersion = "33.0.0"
Also bump
compileSdkVersion
if you’re getting build errors like:Dependency 'androidx.appcompat:appcompat:1.5.1' requires 'compileSdkVersion' to be set to 32 or higher. Compilation target for module ':app' is 'android-31'
ANDROID_HOME
Export ANDROID_HOME
in your config file:
export ANDROID_HOME=$HOME/Library/Android/sdk
Environment Variables
Add the following to your $HOME/.bash_profile
or $HOME/.bashrc
(if you’re using zsh then ~/.zprofile
or ~/.zshrc
) config:
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin
Conclusion
Rerun npx react-native doctor
and you should get no errors:
Android
✓ JDK
✓ Android Studio - Required for building and installing your app on Android
✓ Android SDK - Required for building and installing your app on Android
✓ ANDROID_HOME