I followed official guide to setup React Native project on MacOS 14.1.1 (23B81) macbook air m2 (with a few differences that I will describe next).
Below is the result of npm run android. (npm run ios works perfectly)
info JS server already running.
info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor.
To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor
So, I run npx react-native@lastest doctor but got no error or warning.
Common
✓ Node.js - Required to execute JavaScript code
✓ yarn - Required to install NPM dependencies
✓ Watchman - Used for watching changes in the filesystem when in development mode
Android
✓ Adb - Required to verify if the android device is attached correctly
✓ JDK - Required to compile Java code
✓ Android Studio - Required for building and installing your app on Android
✓ Android SDK - Required for building and installing your app on Android
✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
iOS
✓ Xcode - Required for building and installing your app on iOS
✓ Ruby - Required for installing iOS dependencies
✓ CocoaPods - Required for installing iOS dependencies
✓ ios-deploy - Required for installing your app on a physical device with the CLI
✓ .xcode.env - File to customize Xcode environment
Errors: 0
Warnings: 0
I have no idea what should I fix...
My setup steps that differ from the official guide are
- I have installed
brew install --cask zulu11, but I got an error thatreact-native doctorcould not found AndroidSDK. I tried to fix this problem with several solutions from Google , but the problem still persist.- Download cmdline-tools (Android Studio > SDK Manager > SDK Tools)
- Create local.properties with data
sdk.dir=/Users/<user>/Library/Android/sdk<ref.this answer>
- I downloaded and installed JDK17. Then, update
$JAVA_HOMEin .zshrc. Runjava --versionandecho $JAVA_HOMEto make sure that java version was successfully updated. Runnpx react-native@lastest doctorand found that no issue found.