React Native项目不在Android上启动

时间:2019-01-15 07:06:26

标签: android react-native react-native-android google-play-services

  

java.lang.NoSuchMethodError:没有静态方法   class class checkHandlerThread(Landroid / os / Handler; Ljava / lang / String;)V   Lcom / google / android / gms / common / internal /前提条件;或其超级   类(声明   “ com.google.android.gms.common.internal.Preconditions”出现在   /data/app/tv.ampz-xq0syKD7zk1lwewrOmiHaw==/base.apk!classes35.dex)           在com.google.android.gms.common.internal.GmsClientEventManager.onConnectionSuccess(未知   资料来源:20)           在com.google.android.gms.common.api.internal.zaaw.zab上(未知来源:292)           在com.google.android.gms.common.api.internal.zaak.zaaq(未知   资料来源:125)           在com.google.android.gms.common.api.internal.zaak.onConnected(未知   资料来源:105)           在com.google.android.gms.common.api.internal.zabe.onConnected(未知   资料来源:101)           在com.google.android.gms.common.api.internal.zaq.onConnected(未知   资料来源:6)           在com.google.android.gms.common.internal.zaf.onConnected(未知   资料来源:2)           在com.google.android.gms.common.internal.BaseGmsClient $ zzf.zzm(未知   资料来源:24)           在com.google.android.gms.common.internal.BaseGmsClient $ zza.zza(未知   资料来源:12)           在com.google.android.gms.common.internal.BaseGmsClient $ zzc.zzo(未知   资料来源:11)           在com.google.android.gms.common.internal.BaseGmsClient $ zzb.handleMessage(未知   资料来源:48)           在android.os.Handler.dispatchMessage(Handler.java:106)           在android.os.Looper.loop(Looper.java:193)           在android.app.ActivityThread.main(ActivityThread.java:6669)           在java.lang.reflect.Method.invoke(本机方法)           在com.android.internal.os.RuntimeInit $ MethodAndArgsCaller.run(RuntimeInit.java:493)           在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

我的app / 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:+" 

1 个答案:

答案 0 :(得分:0)

您必须在resolutionStrategy标签中将android添加到您的app / build.gradle中

android {
....
configurations.all {
            resolutionStrategy {
                force "com.google.android.gms:play-services-basement:16.2.0"
            }
        }

...
}