React Native requires installing many packages, so versions are very important. Here are some issues I encountered and how I solved them while developing my app:
1. Java version must be 17
I made sure my Java version matched the one required by my current project.
2. Reinstall React Native
Sometimes builds would fail during development. After some searching, I found that uninstalling and reinstalling react-native-cli and react-native often solves the issue:
npm uninstall -g react-native-cli
npm uninstall -g react-native
npm install -g react-native-cli
npm install -g react-native
3. Fixing react-native-community/cli errors
I ran into an error related to react-native-community/cli, so I removed it from my system.
4. Create a new project
After resolving the above issues, I created a new React Native project:
npx react-native init MyReact
5. Gradle error
Initially, everything seemed fine, but I ran into Gradle errors. Some suggested downgrading Gradle from 8.6 to 8.5, but that didn’t fix it.
It turned out the problem was with Android Studio. The error mentioned it couldn’t find the Gradle from another project I wasn’t currently working on.
The solution was to open my current app project in Android Studio and run it once. After that, building with React Native worked perfectly.
Top comments (0)