android - React 本机项目未在 android 上启动
问题描述
java.lang.NoSuchMethodError:Lcom/google/android/gms/common/internal/Preconditions 类中没有静态方法 checkHandlerThread(Landroid/os/Handler;Ljava/lang/String;)V;或其超类(“com.google.android.gms.common.internal.Preconditions”的声明出现在 com.google 的 /data/app/tv.ampz-xq0syKD7zk1lwewrOmiHaw==/base.apk!classes35.dex 中)。 android.gms.common.internal.GmsClientEventManager.onConnectionSuccess(Unknown Source:20) at com.google.android.gms.common.api.internal.zaaw.zab(Unknown Source:292) at com.google.android.gms。 common.api.internal.zaak.zaaq(Unknown Source:125) at com.google.android.gms.common.api.internal.zaak.onConnected(Unknown Source:105) at com.google.android.gms.common。 com.google 上的 api.internal.zabe.onConnected(未知来源:101)。
我的应用程序/build.gradle
compile project(':react-native-maps')
compile project(':react-native-camera')
compile project(':react-native-linear-gradient')
compile project(':react-native-push-notification')
implementation (project(':react-native-camera')) {
implementation "com.android.support:appcompat-v7:26.1.0"
implementation "com.facebook.react:react-native:+"
}
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation ("com.google.android.gms:play-services-basement:${rootProject.ext.googleFirebaseVersion}") {
force = true
}
implementation "com.google.android.gms:play-services-location:${rootProject.ext.googlePlayServicesVersion}"
implementation "com.google.android.gms:play-services-base:${rootProject.ext.googlePlayServicesVersion}"
implementation "com.google.android.gms:play-services-maps:${rootProject.ext.googlePlayServicesVersion}"
implementation "com.google.firebase:firebase-core:${rootProject.ext.googleFirebaseVersion}"
compile project(':instabug-reactnative')
compile project(':react-native-video')
compile project(':react-native-svg')
compile project(':react-native-picker')
compile project(':react-native-image-crop-picker')
compile project(':react-native-google-places')
compile project(':react-native-fast-image')
compile project(':react-native-exit-app')
compile project(':react-native-device-info')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+"
解决方案
您必须在标签中添加resolutionStrategy
到您的 app/build.gradleandroid
android {
....
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-basement:16.2.0"
}
}
...
}
推荐阅读
- python - 如何在python中将一列秒添加到一列时间?
- ansible - 如何在没有错误的情况下收集ansible中的文件夹列表?
- python-2.7 - centos机器中子包的python路径设置
- python - 如何让openCV保存它对视频所做的更改
- c# - 如何通过 InstaSharper 获取用户 ID
- formatting - 如何让 Google BigQuery 理解像 04.01.2019 07:06:48.607 这样的日期格式?
- css - IE11 在 :hover 和 :active 上将按钮文本移动一些 px
- c# - 无法在剃刀视图中导入 @using System.DirectoryServices
- python - 如何修复 colab 中复古库中的“无效语法”?
- android - 当应用程序在后台并且屏幕被锁定在本机反应时如何唤醒手机屏幕?