react-native: Upgraded JDK 16 react-native run android problem Gradle Complaining
Could not compile settings file ‘C:\Users\Scott\rn\mc\android\settings.gradle’.
startup failed:
General error during semantic analysis: Unsupported class file major version 60
I have a Gradle home system environment variable set Gradle version 7.0.2 currently on Windows 10.
I don’t see that as the issue with Gradle since I’m using npx.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 18 (1 by maintainers)
Go fix this file in your app folder and your problems should be over.
code android/gradle/wrapper/gradle-wrapper.properties
change
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
@dangolbeeker I think you had a typo when changing this file
@dangolbeeker Try this. No need to downgrade anything.
in my case Just changed gradle version in gradle-wrapper.properties to 7.2 or latest version of gradle like this :
distributionUrl=https://services.gradle.org/distributions/gradle-7.2-all.zip
and adding the following line in gradle.properties:
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
this crispy stuff really make people life difficult, so damn annoying
Well this issue needs to fixed asap. I really don’t want to downgrade.
@sameem420 this works for me … Thanks!
here is a tip, you can change your current JAVA_HOME variable, i was having the same error, but it was because i had java JDK 16 and JDK 1.8. use JDK 1.8, and that is it. If you have a mac, here is an artice https://medium.com/@devkosal/switching-java-jdk-versions-on-macos-80bc868e686a
Another possibility is to modify the
gradlew
script to set theJAVACMD
variable yourself. It could be as simple as removing all theJAVA_HOME
and AIX tests and settingJAVACMD
to the full path to the java binary.In my case, I wanted something that’s not tied to my system, so I can push to our team’s repo, so I’m checking if a
java.local
symlink exists, and use that if it does. Otherwise, everything is how it was. (java.local
points to/usr/lib/jvm/java-11-openjdk/bin/java
on my system).