web-dev-qa-db-ja.com

androidをコンパイルしたときの反応 - ネイティブカメラエラー

React Native Projectを最新バージョン(0.59.2)にアップグレードしようとしました。残念ながら、React Native Run-Androidを実行しようとすると、このエラーが発生しました。

_Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-camera.
 Required by:
     project :app
  > Cannot choose between the following variants of project :react-native-camera:
      - generalDebugRuntimeElements
      - mlkitDebugRuntimeElements
    All of them match the consumer attributes:
      - Variant 'generalDebugRuntimeElements':
          - Required com.Android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
          - Found com.Android.build.api.attributes.VariantAttr 'generalDebug' but wasn't required.
          - Required com.Android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
          - Required org.gradle.usage 'Java-runtime' and found compatible value 'Java-runtime'.
          - Found react-native-camera 'general' but wasn't required.
      - Variant 'mlkitDebugRuntimeElements':
          - Required com.Android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
          - Found com.Android.build.api.attributes.VariantAttr 'mlkitDebug' but wasn't required.
          - Required com.Android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
          - Required org.gradle.usage 'Java-runtime' and found compatible value 'Java-runtime'.
          - Found react-native-camera 'mlkit' but wasn't required.
_

私はすでに新しいプロジェクトを作成しようとしましたが、これは同じエラーになります。ノードモジュールを再インストールすることはできませんでした。 iOSでうまく機能します。

22
Kape

defaultConfigブロック内のAndroid/app/build.gradleに次の行を挿入してください。

missingDimensionStrategy 'react-native-camera', 'general'

また

missingDimensionStrategy 'react-native-camera', 'mlkit'

Android/build.gradleにJitPackを追加する

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com" }
    }
}

完全なガイド

プロジェクトを解決できませんでした:React-Native-Camera。Androidの場合

0
AbolfazlR