繁体   English   中英

使用 npx react-native run-android 命令运行 react native 应用程序时出现错误

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

请帮我解决以下错误。 我不明白问题出在哪里。 Node 版本是 v14.18.1,npm 版本是 6.14.15,java 版本 "16.0.1" ,

FAILURE:构建失败,出现异常。

  • 其中:设置文件“C:\\Users\\Admin\\ReactNativeCode\\MyFirstApp\\android\\settings.gradle”

  • 出了什么问题:无法编译设置文件“C:\\Users\\Admin\\ReactNativeCode\\MyFirstApp\\android\\settings.gradle”。

启动失败:语义分析期间的一般错误:不支持的类文件主要版本 60

java.lang.IllegalArgumentException:不支持的类文件主要版本 60

这是我的 bulid.graddle 文件

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' }
    }
}

看起来很多人都有同样的错误。 你可以检查这个线程

并检查系统中安装的open-jdk版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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