Dateline: 2020-01-18
If you have attempted to start a project from the facebook dev site for react native ( https://facebook.github.io/react-native/docs/getting-started ) using the react native CLI, installed the latest OpenJDK ( https://openjdk.java.net/install/ ) and saw it bork with the following error;
FAILURE: Build failed with an exception.
* Where:
Settings file 'C:\_p\js\reactproject\android\settings.gradle'
* What went wrong:
Could not compile settings file 'C:\_p\js\reactproject\android\settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 57
The problem is that the react package is build for Gradle 5.57, and OpenJDK uses Gradle 6. So you have two options. Downgrade to OpenJDK 11 ( https://jdk.java.net/archive/ ), or edit the following file in your project
reactproject\android\gradle\wrapper\gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
There seems to be a lot of problems with the react-native-cli build at time of press, so try some of the following fixes
Some Error relating to android gradle/react-native-community
npm i @react-native-community/cli-platform-android
Expo is a much friendlier start to react native development but will only get you so far. If you have created a few expo apps and are comfortable with react-native, move to the cli and go to the next level of native code integration. It becomes more complex, but only because its opened up more. You don’t necessarily have the expo 25MB base install either.
There are other alternatives, with a react app running in Capacitor, Ionic, or Kotlin/Kotlin.js.