0

When an FCM message is sent to the device. The app crashes with this error:

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) 

I am using the latest FCM version:

com.google.firebase:firebase-messaging:9.6.1

Also the latest gradle:

com.android.tools.build:gradle:2.2.1

I have added classpath 'com.google.gms:google-services:3.0.0'

and added plugin apply plugin: 'com.google.gms.google-services'

AL.
  • 36,815
  • 10
  • 142
  • 281
suku
  • 10,507
  • 16
  • 75
  • 120
  • Provide your activity related to FCM. – Ajith Pandian Oct 11 '16 at 02:25
  • There's nothing related to FCM in the activity. – suku Oct 11 '16 at 02:36
  • Then why are you using FCM? You must have FCM Messaging and Instance ID services implemented on client side to use FCM – Rushi M Thakker Oct 11 '16 at 02:56
  • I have the services implemented. But it doesn't require an activity to start it as the receiver service is launched when the application starts – suku Oct 11 '16 at 03:04
  • @suku As far as I know, this error occurs when Firebase Instance ID services dependency is not properly implemented. Make sure your manifest is proper and `apply plugin: 'com.google.gms.google-services'` is declared outside at the bottom of dependencies. Also Mention @RushiMThakker otherwise I won't know you replied to my comment – Rushi M Thakker Oct 11 '16 at 03:24
  • @RushiMThakker i had not added the google-services plugin below the dependencies but at the top below the android-application . I must not have read the documentation properly. Can you write your above comment as the answer. I'll mark it answered. – suku Oct 11 '16 at 05:10

2 Answers2

1

Make sure apply plugin: 'com.google.gms.google-services' is declared outside below the dependencies.

suku
  • 10,507
  • 16
  • 75
  • 120
Rushi M Thakker
  • 679
  • 2
  • 15
  • 34
0

You should also add com.google.firebase:firebase-core:9.6.1 to your dependencies

Holoceo
  • 168
  • 2
  • 7
  • Without that added I wouldn't have even seen this error – suku Oct 22 '16 at 23:52
  • @suku but i've seen this error without firebase-core. And it was exactly the same as yours. – Holoceo Oct 27 '16 at 10:55
  • Why would firebase core need to be added for fcm...it works without it – suku Oct 27 '16 at 10:58
  • @suku I had NoSuchMethodError: No static method zzz without adding firebase core. And it was gone after I added firebase core. – Holoceo Oct 27 '16 at 12:06
  • OK...because after I changed the code as @rushi suggested, the fcm was working fine...I had not added the firebase core – suku Oct 27 '16 at 12:07