反应本机屏幕:compileDebugKotlin 失败

MIP*_*IPB 15 react-native react-navigation react-native-screens

我正在尝试在我的 RN 项目中使用 React Navigation,但是当我安装react-native-screens(这是它工作所需的包)时,我无法再次构建该项目。

我得到的错误如下:

Task :react-native-screens:compileDebugKotlin FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
Run Code Online (Sandbox Code Playgroud)

我尝试了一些我看到其他人做的事情,但到目前为止没有任何效果。

你能帮助我吗?谢谢

小智 17

我在 android/build.gradle 中将 kotlin 版本更改为 kotlinVersion = "1.5.31"

  • android/build.gradle 中没有 kotlinVersion 或 kotlin_version (4认同)
  • 谢谢你!你引导我走向正确的方向,我的 build.gradle 中有 kotlin_version 而不是 kotlinVersion :) (2认同)

Ish*_*han 12

如果您在将@react-navigation/native@6.0.10库添加到项目后react-native @0.69.0仅升级react-native-screens@3.14.0此特定版本后遇到此问题


lak*_*ath 12

更新 android/build.gradle 如下:

 {
 buildscript {
  ext {
      ...
     kotlinVersion = "1.5.31"
  }
 dependencies { 
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

注意:如果再次出现此错误,请从模拟器中卸载应用程序并重新构建,或者删除此模拟器并创建新的模拟器并尝试。

在此输入图像描述


小智 11

如果您在 2022 年 11 月 4 日之后发现此问题,它可能与问题 35210 有关:

自 2022 年 11 月 4 日以来发生的 Android 构建失败