安装React Navigation后无法构建或安装React Native应用

问题描述 投票:1回答:1

我刚刚开始构建我的第一个React Native应用,但收效甚微。我已经建立了样板代码,但是现在我想为其添加一个单独的屏幕。提示反应导航。

尝试安装模块两次,我运气不太好。我使用了React Navigation本身的Facebook's documentationGetting Started指南。仍然没有运气。

我得到的错误与我的android文件夹中的build.gradle文件有关。根据入门指南,我确实在依赖项区域中添加了两行,但这似乎没有任何效果。

错误消息如下:

Could not compile build file: 
'C:\Users\USERNAME\Documents\ReactNative\WasteAway\android\app\build.gradle\'
> startup failed
General error during semantic analysis: Unsupported class file major version 57

我对build.gradle文件的依赖性如下:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

我是否在这里遗漏了一些明显的内容,或者我跳过了教程的步骤?伙计们,我看不到我要去哪里错了。非常感谢您的帮助。

javascript android react-native react-native-android react-navigation
1个回答
0
投票

自从收到有关解决方案的建议后,回答此问题:看来这是我使用的JDK版本导致问题。奇怪的是,我使用的是臭名昭著的越野车。卸载和还原JDK1.8解决了我的问题。说明here

© www.soinside.com 2019 - 2024. All rights reserved.