1

My SSD got screwed, so I had to start everything fresh. Now I'm stuck in setup. I followed React native environment setup step by step very carefully and before that I installed Java 16. Now when I try to launch fresh project I initialized this is what I get:

  FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\Users\Alyz\Documents\testProj\android\settings.gradle'

* What went wrong:
Could not compile settings file 'C:\Users\Alyz\Documents\testProj\android\settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 60
  
  java.lang.IllegalArgumentException: Unsupported class file major version 60
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
...
     
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Alythrope
  • 21
  • 2
  • Android studio wasnt respecting my java version in the project structure. needed to set the JAVA_HOME for it to use openjdk 8 like specified in the react-native environment-setup. I lost a week and hours of sleep before discovering this. https://stackoverflow.com/questions/21964709/how-to-set-or-change-the-default-java-jdk-version-on-macos – raddrick Jul 07 '21 at 06:08

3 Answers3

0

I just found a forum post saying that they do not support Java 16. After downgrading to Java 15 everything worked.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Alythrope
  • 21
  • 2
0

I had the same problem when I tried npm run android. After removing the JDK 16 (which I have manually installed after downloading from Oracle) using the below commands

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Oracle/Java

cd /Library/Java/JavaVirtualMachines && rm -rf  jdk-16.0.1.jdk

and then installing JAVA 14 using homebrew

brew tap AdoptOpenJDK/openjdk 
brew install --cask adoptopenjdk14


 
Sathishkumar Rakkiyasamy
  • 3,509
  • 2
  • 30
  • 34
-1

Gradle does not support Java 16 yet. https://docs.gradle.org/current/userguide/compatibility.html

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Cheese
  • 11
  • 2
    @StupidWolf The _"Gradle does not support JAVA 16 yet"_ looks like an answer to me, the link is just to support that answer. – Mark Rotteveel Apr 09 '21 at 09:48