bugthefifth
bugthefifth

Reputation: 169

gradle faults at react-native project run, windows 10

Trying to set up react-native development environment with android studio

I have a fault I don't know what to do with it...

Here is the run and feedback from machine:

npx react-native run-android (from the created project folder)

It gives me back the following:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 903 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\projects\projectfour\android\settings.gradle'

* What went wrong:
Could not compile settings file 'C:\projects\projectfour\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)...

...

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 801ms

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\projects\projectfour\android\settings.gradle'

* What went wrong:
Could not compile settings file 'C:\projects\projectfour\android\settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 60

setting file for gradle:

rootProject.name = 'projectfour'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

I have jdk16... I saw posts where it was advised to go to jdk8... these posts were made couple of years ago...

I tried also: ./gradlew.bat installDebug gradlew.bat app:installDebug gradlew clean

All with the same result. I followed this doc: https://microsoft.github.io/react-native-windows/docs/getting-started and this one: https://reactnative.dev/docs/environment-setup

Cannot make it work on my comp, although on other one I had no such difficulties... Somehow

Upvotes: 1

Views: 1931

Answers (1)

Sebastian Breit
Sebastian Breit

Reputation: 26

Try installing JDK8 and setting the environment variable JAVA_HOME to the JDK8 path

Upvotes: 1

Related Questions