我的应用程序在Android Studio上运行良好,可以在react-native run-android
上正常运行,但是当我尝试生成.apk
时,它会通过./gradlew assembleRelease
命令失败。我收到以下错误。
* What went wrong:
Could not determine the dependencies of task ':react-native-camera:compileMlkitReleaseAidl'.
> Could not resolve all task dependencies for configuration ':react-native-camera:mlkitReleaseCompileClasspath'.
> Could not find com.google.firebase:firebase-ml-vision:12.0.1.
Required by:
project :react-native-camera
> Could not find com.google.firebase:firebase-ml-vision-face-model:12.0.1.
Required by:
project :react-native-camera
"react": "16.8.3",
"react-native": "0.59.10",
"react-native-camera": "^3.7.1",
"react-native-image-picker": "^0.28.1",
"react-native-qrcode-scanner": "^1.2.3",
classpath('com.android.tools.build:gradle:3.4.0') // FROM android/gradle.build
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip // FROM gradle-wrapper.properties
我已遵循安装说明here,并遵循了GitHub链接here和here。
所有人都有我已经完成的相同解决方案,即添加;
android {
defaultConfig {
missingDimensionStrategy 'react-native-camera', 'general'
}
}
问题是因为即使我没有选择mlkit
依赖项,android也在寻找它们。我认为这是因为我使用了react-native-image-picker
和react-native-qrcode-scanner
这些软件包之一来寻找mlkit依赖关系。但是我不知道如何调试和修复它。
答案 0 :(得分:0)
请确保您在android / app / build.gradle中添加了此
missingDimensionStrategy 'react-native-camera', 'general' in *defaultConfig*
然后在构建时检查Internet连接是否良好。 如果不起作用,请使用 npm运行发行版