android - 我的 npx react-native run-android 构建失败
问题描述
我的同事最近添加react-native-camera
到我的项目中。我合并了代码,当我运行npx react-native run-android
我的构建失败时:
FAILURE: Build failed with an exception.
* What went wrong:
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' capability Rombot:react-native-camera:unspecified:
- Unmatched attributes:
- Found com.android.build.api.attributes.VariantAttr 'generalDebug' but wasn't required.
- Found react-native-camera 'general' but wasn't required.
- Compatible attributes:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- 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'.
- Variant 'mlkitDebugRuntimeElements' capability Rombot:react-native-camera:unspecified:
- Unmatched attributes:
- Found com.android.build.api.attributes.VariantAttr 'mlkitDebug' but wasn't required.
- Found react-native-camera 'mlkit' but wasn't required.
- Compatible attributes:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- 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'.
我试图删除我的节点模块,然后做一个npm install
,但我仍然得到同样的错误。任何帮助都会很棒。提前致谢。
解决方案
删除 React-Native-Camera 依赖并再次安装。跑
cd android
./gradlew clean
并再次运行应用程序
推荐阅读
- python - 未能设置“pythonPath”。错误:无法写入用户设置。请打开用户设置以更正其中的错误/警告,然后重试
- flutter - 我需要按两次按钮才能正常工作(颤动)
- python - 查找给定值的所有键
- javascript - Angular以base64格式获取远程图像URL
- java - Activity does not have a NavController set on
- javascript - Menu closing after going to the related section from the hamburger menu
- flutter - 有没有办法同时拥有一个 floatingActionButton 和一个 SpeedDial?
- android - 从活动调用协程函数返回“只能从协程或另一个挂起函数调用”
- android - 在片段之间传递数据时出错
- kubernetes - Kubernetes 入口路由