简体   繁体   中英

while running the react native app with npx react-native run-android Command it gives an error

Please help me to solve the following error. I didn't understand where is the problem. Node version is v14.18.1, npm version is 6.14.15, java version "16.0.1" ,

FAILURE: Build failed with an exception.

  • Where: Settings file 'C:\\Users\\Admin\\ReactNativeCode\\MyFirstApp\\android\\settings.gradle'

  • What went wrong: Could not compile settings file 'C:\\Users\\Admin\\ReactNativeCode\\MyFirstApp\\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

this is my bulid.graddle file

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
    }
}

Looks like many had the same error. You can check this thread

and check the open-jdk version installed in your system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM