0

I am integrating Firebase Cloud Messaging Service in my Android app. Currently my app extends the Application class (named as MainApplication) and is declared in manifest application tag.

I have followed all the instructions to enable Firebase Cloud Messaging. When I run the app I receive below stack-trace

04-03 17:05:16.099 20911-20911/<package_name> E/FA: Failed to load metadata: Package name not found: android.content.pm.PackageManager$NameNotFoundException: : com.google.android.gms.internal.zzadf.getApplicationInfo(Unknown Source)
04-03 17:05:16.099 20911-20911/<package_name> E/FA: Scheduler not set. Not logging error/warn
04-03 17:05:16.099 20911-20911/<package_name> E/FA: Failed to load metadata: Package name not found: android.content.pm.PackageManager$NameNotFoundException: : com.google.android.gms.internal.zzadf.getApplicationInfo(Unknown Source)
04-03 17:05:16.099 20911-20911/<package_name> E/FA: Scheduler not set. Not logging error/warn
04-03 17:05:16.100 20911-20911/<package_name> V/FA: Collection enabled
04-03 17:05:16.100 20911-20911/<package_name> V/FA: App package, google app id: 1:744836320047:android:a611bb33ea5170ee
04-03 17:05:16.100 20911-20911/<package_name> I/FA: To enable faster debug mode event logging run:
                                                          adb shell setprop debug.firebase.analytics.app 
04-03 17:05:16.100 20911-20911/<package_name> D/FA: Debug-level message logging enabled
04-03 17:05:16.103 20911-20911/<package_name> 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.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:5262)
                                                                     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4847)
                                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4787)
                                                                     at android.app.ActivityThread.access$1600(ActivityThread.java:154)
                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452)
                                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                     at android.os.Looper.loop(Looper.java:234)
                                                                     at android.app.ActivityThread.main(ActivityThread.java:5526)
                                                                     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)
                                                                  Caused by: java.lang.SecurityException: Permission Denial: getIntentSender() from pid=20911, uid=10252, (need uid=-1) is not allowed to send as package 
                                                                     at android.os.Parcel.readException(Parcel.java:1627)
                                                                     at android.os.Parcel.readException(Parcel.java:1579)
                                                                     at android.app.ActivityManagerProxy.getIntentSender(ActivityManagerNative.java:4032)
                                                                     at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:531)
                                                                     at android.app.PendingIntent.getBroadcast(PendingIntent.java:515)
                                                                     at com.google.android.gms.internal.zzaup.zzpE(Unknown Source)
                                                                     at com.google.android.gms.internal.zzaup.zzmS(Unknown Source)
                                                                     at com.google.android.gms.internal.zzauh.initialize(Unknown Source)
                                                                     at com.google.android.gms.internal.zzaue.<init>(Unknown Source)
                                                                     at com.google.android.gms.internal.zzaui.zzMP(Unknown Source)
                                                                     at com.google.android.gms.internal.zzaue.zzbM(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:5262) 
                                                                     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4847) 
                                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4787) 
                                                                     at android.app.ActivityThread.access$1600(ActivityThread.java:154) 
                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452) 
                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                     at android.os.Looper.loop(Looper.java:234) 
                                                                     at android.app.ActivityThread.main(ActivityThread.java:5526) 
                                                                     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) 
04-03 17:05:16.105 20911-20911/<package_name> I/FirebaseInitProvider: FirebaseApp initialization successful

Even the token is not generated. But when I remove the application name attribute from application tag in manifest i.e. not specifying my application class in manifest. The above error goes away and I get the token.

I have tried calling

FirebaseApp.initializeApp(this);

in onCreate of my application class, but still getting this error. Currently I am using below Firebase version but have tried with earlier version also, but still receiving the error stack.

compile 'com.google.firebase:firebase-messaging:10.2.1'

It does not make sense to remove the extended Application class in order to use Firebase. Not sure what is needed to be done.

Thanks

Adil Bhatty
  • 17,190
  • 34
  • 81
  • 118
  • If cloud messaging is the only purpose of your application as of now, you don't actually need to write this line.. – Chintan Soni Apr 03 '17 at 07:18
  • @ChintanSoni, I am not using, this is one of the solution which I found online, but that is not working. That is why seeking for alternate solution to fix the issue. Thanks – Adil Bhatty Apr 03 '17 at 22:37

0 Answers0