react-native-gradle-plugin 和 gradlew assembleDebug 不起作用

react-native-gradle-plugin and gradlew assembleDebug not working

提问人:Fullstack Developer 提问时间:7/1/2023 最后编辑:M.KFullstack Developer 更新时间:8/17/2023 访问量:281

问:

当我尝试使用 Java 17 和 gradle 7.3 构建我的 apk 时,我遇到了这个问题:gradlew assembleDebug

e: C:\Users\Osama\Desktop\expo-app\node_modules\react-native-gradle-plugin\src\main\kotlin\com\facebook\react\tasks\BundleHermesCTask.kt: (138, 11): This declaration is experimental and its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':react-native-gradle-plugin:compileKotlin'.

> Compilation error. See log for more details

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s

1 actionable task: 1 executed

这是我的gradle包装器属性:

distributionBase=GRADLE_USER_HOME

distributionPath=wrapper/dists

distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip

zipStoreBase=GRADLE_USER_HOME

zipStorePath=wrapper/dists

大家好。当我尝试使用 Java 17 和 gradle 7.3 构建我的 apk 时,我遇到了这个问题:gradlew assembleDebug

e: C:\Users\Osama\Desktop\expo-app\node_modules\react-native-gradle-plugin\src\main\kotlin\com\facebook\react\tasks\BundleHermesCTask.kt: (138, 11): This declaration is experimental and its usage must be marked with @kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':react-native-gradle-plugin:compileKotlin'.

> Compilation error. See log for more details

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s

1 actionable task: 1 executed

This is my gradle wrapper  properties:

distributionBase=GRADLE_USER_HOME

distributionPath=wrapper/dists

distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip

zipStoreBase=GRADLE_USER_HOME

zipStorePath=wrapper/dists

我尝试了很多次,我希望建立我的apk。gradlew assembleDebug

react-native android-gradle-插件

评论


答:

0赞 saqib 7/3/2023 #1

几周前我遇到了类似的问题,我不得不升级 react-native 版本来解决这个问题。我将 react native 0.65 升级到 0.69

如果你在升级 React 原生项目时需要帮助,请查看升级到新版本的官方文档