将FCM消息发送到设备时。该应用程序崩溃时出现此错误:
Caused by: java.lang.NoSuchMethodError: No static method zzz(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/data/com.dodum.ahivelnr/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-9.6.1_edeb30b4cf5821e3a8ccd94cce4eee06ac81c766-classes.dex)
at com.google.android.gms.measurement.internal.zzx.zzbd(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5197)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4792)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4732)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
我使用的是最新的FCM版本:
com.google.firebase:firebase-messaging:9.6.1
也是最新的gradle:
com.android.tools.build:gradle:2.2.1
我添加了classpath 'com.google.gms:google-services:3.0.0'
并添加了插件apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:1)
确保在 依赖项<。>之外声明apply plugin: 'com.google.gms.google-services'
。
答案 1 :(得分:0)
您还应该将 com.google.firebase:firebase-core:9.6.1 添加到您的依赖项