无法在升级后构建React Native应用程序。

huangapple go评论111阅读模式
英文:

Can't build React Native app after upgrade

问题

我遇到了这个错误:

> 配置项目:react-native-vision-camera
VisionCamera:在以下位置找到 node_modules/:/home/ed/sc/shuttlecontrol-driver/node_modules
VisionCamera:使用 Hermes 构建中…
警告:‘kotlin-android-extensions’ Gradle 插件已弃用。请使用此迁移指南 (https://goo.gle/kotlin-android-extensions-deprecation) 开始使用 View Binding (https://developer.android.com/topic/libraries/view-binding) 和 ‘kotlin-parcelize’ 插件。
VisionCamera:启用了帧处理器!构建 C++ 部分中…
警告:DSL 元素 ‘dexOptions’ 已过时,应予以删除。
它将在 Android Gradle 插件的 8.0 版中移除。
使用它没有效果,AndroidGradle 插件会自动优化 dexing。

失败:构建失败,出现了问题。

* 出了什么问题:
配置项目 ‘:react-native-vision-camera’ 时出现问题。
> 无法通知项目评估监听器。
   > 无法创建任务 ‘:react-native-vision-camera:compileDebugAndroidTestKotlin’。
      > 无法在方法 AbstractKotlinCompile.execute() 上使用 @TaskAction 注释,因为接口 org.gradle.api.tasks.incremental.IncrementalTaskInputs 不是动作方法的有效参数。
   > 找不到名称为 ‘debugAndroidTest’ 的 KotlinJvmAndroidCompilation。

从 0.70.6 升级到 0.72.1 后出现了这个错误。

我尝试过 rm -r android/build ; rm -r android/app/src/release/res ; rm -r android/app/build/intermediates./gradlew clean(在 android 文件夹中执行),但也失败了。

在运行 npm run android 后,构建总是失败,并显示上述错误。

英文:

I'm getting this error:

> Configure project :react-native-vision-camera
VisionCamera: node_modules/ found at: /home/ed/sc/shuttlecontrol-driver/node_modules
VisionCamera: Building with Hermes...
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
VisionCamera: Frame Processors are enabled! Building C++ part...
WARNING:DSL element 'dexOptions' is obsolete and should be removed.
It will be removed in version 8.0 of the Android Gradle plugin.
Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':react-native-vision-camera'.
> Failed to notify project evaluation listener.
   > Could not create task ':react-native-vision-camera:compileDebugAndroidTestKotlin'.
      > Cannot use @TaskAction annotation on method AbstractKotlinCompile.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
   > KotlinJvmAndroidCompilation with name 'debugAndroidTest' not found.

after upgrading from 0.70.6 to 0.72.1

I tried rm -r android/build ; rm -r android/app/src/release/res ; rm -r android/app/build/intermediates and ./gradlew clean (in the android folder and it failed too)

After npm run android the build always fails with the above error.

答案1

得分: 1

我通过在 android/build.gradle 中添加以下内容来解决了这个问题:

buildscript {
    ext {
        ...
        kotlinVersion = "1.6.21"
        ...
    }
}
英文:

I got passed this problem by adding

buildscript {
    ext {
        ...
        kotlinVersion = "1.6.21"
        ...
    }

in android/build.gradle.

答案2

得分: 1

你的 react-native-vision-camera 出现了错误。

前往该库的文档,验证该库与当前的 react-native 版本是否兼容。错误信息明确显示了已弃用的插件和过时的 DSL 元素在项目配置期间引发问题。

检查问题并阅读文档以验证兼容性。

1). https://github.com/mrousavy/react-native-vision-camera

2). https://www.npmjs.com/package/react-native-clarity

英文:

Your react-native-vision-camera is making an error.

Go to the documentation of the library and verify the compatibility of the library with the current react-native version. The error message is clearly shown deprecated plugins and obsolete DSL elements causing problems during the project configuration

Check on the issues and Read documentation to check compatibility.

1). https://github.com/mrousavy/react-native-vision-camera

2). https://www.npmjs.com/package/react-native-clarity

huangapple
  • 本文由 发表于 2023年7月6日 20:39:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76628928.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定