【问题标题】:Can't build or install React Native app after installing React Navigation安装 React Navigation 后无法构建或安装 React Native 应用程序
【发布时间】:2020-03-03 18:07:33
【问题描述】:

我刚刚开始构建我的第一个 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
    }
}

我是否在这里遗漏了一些明显的东西,或者我跳过了教程中的一步?伙计们,我看不出我在哪里出错了。非常感谢任何帮助。

【问题讨论】:

  • 请写完整的gradle日志

标签: javascript android react-native react-native-android react-navigation


【解决方案1】:

在我被告知解决方案后回答这个问题: 看起来是我使用的 JDK 版本导致了问题。奇怪的是,我使用的版本太新,而且臭名昭著。卸载和恢复 JDK1.8 解决了我的问题。解释here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-12-22
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 2018-02-18
    相关资源
    最近更新 更多