Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase API initialization failure

I tried using FCM first time(No prior experience of GCM). So, i just copied code from quickstart-android-push-notifs and set-up the dashboard

as i send a message from dashboard, the app force closes, here are related files


app level build.gradle dependencies

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.+'
    compile 'com.google.firebase:firebase-messaging:9.4.0'
}

logs:

08-22 22:59:38.360 12349-21221/com.rg.fcmsample E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
                                                              Process: com.rg.fcmsample, PID: 12349
                                                              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.rg.fcmsample/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-9.4.0_893226f39952d5ea4f5509d84b650028d7d5f6b4-classes.dex)
                                                                  at com.google.android.gms.measurement.internal.zzx.zzbd(Unknown Source)
                                                                  at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
                                                                  at com.google.firebase.messaging.zzb.zzes(Unknown Source)
                                                                  at com.google.firebase.messaging.zzb.zzc(Unknown Source)
                                                                  at com.google.firebase.messaging.zzb.zzl(Unknown Source)
                                                                  at com.google.firebase.messaging.FirebaseMessagingService.zzn(Unknown Source)
                                                                  at com.google.firebase.messaging.FirebaseMessagingService.zzm(Unknown Source)
                                                                  at com.google.firebase.iid.zzb$2.run(Unknown Source)
                                                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                  at java.lang.Thread.run(Thread.java:818)
08-22 22:59:49.015 12349-21221/com.rg.fcmsample I/Process: Sending signal. PID: 12349 SIG: 9
08-22 23:00:10.549 21506-21506/com.rg.fcmsample W/System: ClassLoader referenced unknown path: /data/app/com.rg.fcmsample-2/lib/arm
08-22 23:00:10.764 21506-21506/com.rg.fcmsample W/System: ClassLoader referenced unknown path: /data/app/com.rg.fcmsample-2/lib/arm
08-22 23:00:10.799 21506-21506/com.rg.fcmsample D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
08-22 23:00:10.817 21506-21506/com.rg.fcmsample D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
08-22 23:00:10.887 21506-21506/com.rg.fcmsample E/FirebaseApp: Firebase API initialization failure.
                                                               java.lang.reflect.InvocationTargetException
                                                                   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.zzek(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:5174)
                                                                   at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
                                                                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
                                                                   at android.app.ActivityThread.access$1600(ActivityThread.java:154)
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                   at android.os.Looper.loop(Looper.java:148)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:5443)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
                                                                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.rg.fcmsample/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-9.4.0_893226f39952d5ea4f5509d84b650028d7d5f6b4-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.zzek(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:5174) 
                                                                   at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769) 
                                                                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709) 
                                                                   at android.app.ActivityThread.access$1600(ActivityThread.java:154) 
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415) 
                                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                   at android.os.Looper.loop(Looper.java:148) 
                                                                   at android.app.ActivityThread.main(ActivityThread.java:5443) 
                                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
08-22 23:00:10.889 21506-21506/com.rg.fcmsample I/FirebaseInitProvider: FirebaseApp initialization successful

what's wrong?

like image 884
Ritesh goel Avatar asked Mar 11 '23 08:03

Ritesh goel


1 Answers

You should insert this code on build.gradle

"compile 'com.google.firebase:firebase-core:9.4.0'

I am fixed now.

like image 120
seyeon Avatar answered Apr 26 '23 10:04

seyeon