java.lang.NoSuchMethodError:类Lcom / google / android / gms / common / util / zzu中没有静态方法;

时间:2017-12-16 06:08:53

标签: android google-play-services

更新我的库和错误日志后,应用程序崩溃了:

java.lang.NoSuchMethodError: No static method getNoBackupFilesDir(Landroid/content/Context;)
in class Lcom/google/android/gms/common/util/zzu;                                                                           at com.google.android.gms.iid.zzh.<init>(Unknown Source)                                                                          at com.google.android.gms.iid.zzh.<init>(Unknown Source)                                                                          at com.google.android.gms.iid.InstanceID.zza(Unknown Source)                                                                          at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)                                                                          at com.quickblox.messages.services.a.c.<init>(Unknown Source)                                                                          at com.quickblox.messages.services.a.d.a(Unknown Source)                                                                          at com.quickblox.messages.services.SubscribeService.a(Unknown Source)                                                                          at com.quickblox.messages.services.SubscribeService.a(Unknown Source)                                                                          at com.quickblox.messages.services.SubscribeService.b(Unknown Source)                                                                          at com.quickblox.messages.services.SubscribeService.c(Unknown Source)                                                                          at com.quickblox.messages.services.SubscribeService.onHandleIntent                                                                        at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)                                                                        at android.os.Looper.loop(Looper.java:135)                                                                        at android.os.HandlerThread.run(HandlerThread.java:61)

我的图书馆版本:

compileSdkVersion 25
buildToolsVersion '26.0.3'
defaultConfig {
    multiDexEnabled true
    minSdkVersion 16
    targetSdkVersion 25
}

dependencies {

    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.google.android.gms:play-services-places:11.6.2'
    compile 'com.google.android.gms:play-services-location:11.6.2'
    compile 'com.google.firebase:firebase-messaging:11.6.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    compile 'com.quickblox:quickblox-android-sdk-core:3.4'
    compile 'com.quickblox:quickblox-android-sdk-videochat-webrtc:3.4'
    compile 'com.quickblox:quickblox-android-sdk-messages:3.4'

}
apply plugin: 'com.google.gms.google-services'

2 个答案:

答案 0 :(得分:2)

我们需要使用相同版本的库。 我用的是quickblox sdk。 为了在我的项目中使用具有相同版本的所有库,需要它(Quickblox SDK中的这个库的版本是11.4.2但是我们项目中的所有库必须是相同的版本) 我在build.gradle.

中添加了两个库来解决此问题
   compile "com.google.firebase:firebase-core:11.6.2"
   compile "com.google.android.gms:play-services-gcm:11.6.2"

答案 1 :(得分:2)

只需将Google Play Service版本更新为app level build.gradle file中的最新版本即可。

eg. :- compile 'com.google.android.gms:play-services-places:12.0.0'

将您的Firebase version升级到最新且相当于Google Play服务版。

e.g:- compile 'com.google.firebase:firebase-core:12.0.0'
    compile 'com.google.firebase:firebase-messaging:12.0.0'

在镜头中将应用级build.gradle文件中的所有依赖项升级到最新版本,并确保您的firebase和google play服务依赖项版本相同。