React Native相机包导致构建失败

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

React native camera package causing build to fail

问题

无法找到关于这个的详细信息。

我们有一个标准的React Native CLI项目。
版本

  • React: 18.2.0
  • React Native: 0.71.1

就我所知,没有编辑任何配置文件的内容。

我们已添加以下npm包以访问和管理相机使用
npm install react-native-vision-camera

没有在应用程序的任何地方导入该包。现在构建失败,出现以下输出。
React Native相机包导致构建失败

我尝试了各种不同的npm相机包,它们都遇到了类似的问题。
如果我卸载该包,应用程序将再次成功构建。

有什么想法我在哪里出错了吗?

英文:

Unable to find much info on this.

We have a standard React-native CLI project.
Versions

  • React: 18.2.0
  • ReactNative: 0.71.1

None of the configuration files have been edited from default as far as i'm aware.

We have added the following npm package to access and manage camera usage
npm install react-native-vision-camera

Without importing the package anywhere in the app. The build is now failing with the following outputs.React Native相机包导致构建失败

I've tried various npm camera packages, they have all suffered similar issues.
If I uninstall the package. The app builds fine again.

Any ideas what i'm doing wrong?

答案1

得分: 1

你需要告诉此包使用正确的Kotlin版本。尝试将以下行添加到你的 android/build.gradle 文件中:

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 23
        compileSdkVersion = 33
        targetSdkVersion = 33
        // For @react-native-community/netinfo package
        androidXCore = "1.0.2"
        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"

        kotlin_version = '1.6.20'    // <-- 添加这一行
        kotlinVersion = '1.6.20'     // <-- 添加这一行
    }
    ...
    ...
    ...
}
英文:

You need to tell this package to use the correct Kotlin version. Try to add the following lines to your android/build.gradle file:

buildscript {
    ext {
        buildToolsVersion = &quot;33.0.0&quot;
        minSdkVersion = 23
        compileSdkVersion = 33
        targetSdkVersion = 33
        // For @react-native-community/netinfo package
        androidXCore = &quot;1.0.2&quot;
        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = &quot;23.1.7779620&quot;

        kotlin_version = &#39;1.6.20&#39;    // &lt;-- Add this
        kotlinVersion = &#39;1.6.20&#39;     // &lt;-- Add this
    }
    ...
    ...
    ...

huangapple
  • 本文由 发表于 2023年2月14日 21:56:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75448871.html
匿名

发表评论

匿名网友

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

确定