java.lang.NoSuchMethodError: No static method in class Lcom/google/android/gms/common/util/zzu;

java.lang.NoSuchMethodError: No static method in class Lcom/google/android/gms/common/util/zzu;

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

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'

我们需要使用相同版本的库。 我使用的是 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"

只需将 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 播放服务依赖项版本相同。