Missing cloud messaging permission though I am not using Firebase Cloud Messaging - android

I am using Firebase Crash Reporting and Firebase Remote Config, but I am not using Firebase Cloud Messaging. Version of both is 9.8.0.
So, I don't understand why am I seeing this error in logs:
java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1266)
at android.app.ContextImpl.startService(ContextImpl.java:1243)
at android.content.ContextWrapper.startService(ContextWrapper.java:588)
at com.google.firebase.iid.zzf.zzb(Unknown Source)
at com.google.firebase.iid.zzf.zza(Unknown Source)
at com.google.firebase.iid.zzf.zzb(Unknown Source)
at com.google.firebase.iid.zzf.zza(Unknown Source)
at com.google.firebase.iid.zzd.zzc(Unknown Source)
at com.google.firebase.iid.zzd.getToken(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getToken(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.zzaae(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zza(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.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)
Could it be, because I am depending on Google Cloud Messaging (but not using - library dependency - internal company library)?
Does it have any serious consequences?

As mentioned by Doug Stevenson in this groups post, the RECEIVE, C2D_MESSAGE, and WAKE_LOCK permissions are required by Analytics, Crash Reporting, and Remote Config.
The primary use is to generate secure tokens and, in the case of WAKE_LOCK, to prevent data loss, by keeping Android from killing the app's process before it's able to transmit collected data.

Related

Google Places API Crash Javalite clash with other Firebase APIs

When I leave the Google Places API on idle after initialization, the application crashes with the stack trace as described at the end of this description.
I initialize the Places API once and only once in the manner described below
if(!Places.isInitialized()) {
val apiKey = loadApiKey()
Places.initialize(getApplication(), apiKey)
}
val client = Places.createClient(getApplication())
After running the above method and left on idle, the application crashes with the following stack trace.
I am assuming this is happening because of a clash between my javalite libraries and the protobuf java libraries.
java.lang.ExceptionInInitializerError
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1)
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.RuntimeException: Unable to get message info for com.google.android.datatransport.cct.a.zze
at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:62)
at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:143)
at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:55)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107)
at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:175)
at com.google.android.datatransport.cct.a.zze.<clinit>(com.google.android.datatransport:transport-backend-cct##2.1.0:2)
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1) 
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9) 
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121) 
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88) 
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:919) 
Caused by: java.lang.UnsupportedOperationException
at com.google.android.datatransport.cct.a.zze.dynamicMethod(com.google.android.datatransport:transport-backend-cct##2.1.0:2)
at com.google.protobuf.GeneratedMessageLite.dynamicMethod(GeneratedMessageLite.java:256)
at com.google.protobuf.GeneratedMessageLite.buildMessageInfo(GeneratedMessageLite.java:284)
at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:60)
at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:143) 
at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:55) 
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93) 
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107) 
at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:175) 
at com.google.android.datatransport.cct.a.zze.<clinit>(com.google.android.datatransport:transport-backend-cct##2.1.0:2) 
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1) 
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9) 
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121) 
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88) 
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:919) 
There might be an issue with the library's protobuffer integration clashing with the one I am using within my application.
As per this issue tracker I created and mentioned by the comments.
https://issuetracker.google.com/issues/161157921.
For now, simply add the following to update the internal Places dependencies on Protobufer libraries until they push out a Places version > 2.3.0
implementation 'com.google.android.datatransport:transport-runtime:2.2.3'
implementation 'com.google.android.datatransport:transport-backend-cct:2.3.0'

Try send message to test if FCM works but the app crash

Trying to build a Firebase chat app and wanted to test if FCM works. Tried testing the notification function by sending a cloud messaging from the firebase console but the app crash in all the devices.
This is the error retrive from the logcat
06-30 16:11:07.783 26794-26794/com.example.ryzeng.firebasechat
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ryzeng.firebasechat, PID: 26794
java.lang.NoSuchMethodError: No static method zzad()Lcom/google/firebase/iid/zzan; in class
Lcom/google/firebase/iid/zzan; or its super classes (declaration of
'com.google.firebase.iid.zzan' appears in
/data/app/com.example.ryzeng.firebasechat-2/split_lib_dependencies_apk.apk)
at com.google.firebase.messaging.FirebaseMessagingService.zzb(Unknown
Source)
at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3366)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1612)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6236)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
In your project files , in file build.gradle ("Module: app")
change version of firebase messaging to last version like :
implementation 'com.google.firebase:firebase-messaging:20.1.4'
Work for me
When i Update firebase messaging dependency
from
implementation 'com.google.firebase:firebase-messaging:17.0.0'
to
implementation 'com.google.firebase:firebase-messaging:17.3.1'
It happens when you implement 2 or more Firebase with different versions.
So it's better to give same version to all firebase's implementation.
implementation 'com.google.firebase:firebase-ads:17.1.3'

Fabric crashlytics with Firebase unable to upload crash

I'm just trying to migrate Fabric Crashlytics with Firebase, so I just followed the guide https://firebase.google.com/docs/crashlytics/get-started
Everything compiles and the app can be launched. So I want to simulate a crash with Crashlytics.getInstance().crash(); as I already used before.
The app crashes as expected, but the crash is not uploaded to firebase and I have this strange stack:
E/Fabric: Error performing auto configuration.
io.fabric.sdk.android.services.network.HttpRequest$HttpRequestException: java.net.ProtocolException: Too many follow-up requests: 21
at io.fabric.sdk.android.services.network.HttpRequest.code(HttpRequest.java:1355)
at io.fabric.sdk.android.services.settings.AbstractAppSpiCall.invoke(AbstractAppSpiCall.java:86)
at io.fabric.sdk.android.services.settings.UpdateAppSpiCall.invoke(UpdateAppSpiCall.java:29)
at io.fabric.sdk.android.Onboarding.performUpdateApp(Onboarding.java:204)
at io.fabric.sdk.android.Onboarding.performUpdateApp(Onboarding.java:194)
at io.fabric.sdk.android.Onboarding.performAutoConfigure(Onboarding.java:175)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:112)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:45)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
Caused by: java.net.ProtocolException: Too many follow-up requests: 21
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:451)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:567)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)
Anyone already had encountered this error?
This can happen when you strip the API key from Fabric when migrating from Fabric to Firebase Crashlytics, which is not currently supported. When migrating, keep your API key in your project.

how to solve this firebase IllegalStateException when use goolge analytics

Projects
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}
Module
dependencies {
compile 'com.google.android.gms:play-services-analytics:10.0.0'
}
It just happened in 8.0 system, but i haven't used any firebase code in my project
Fatal Exception: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf (has extras) }: app is in background uid UidRecord{e2ab7c6 u0a30 CEM idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1538)
at android.app.ContextImpl.startService(ContextImpl.java:1484)
at android.content.ContextWrapper.startService(ContextWrapper.java:663)
at com.google.firebase.iid.zzf.zzbi(Unknown Source:149)
at com.google.firebase.iid.zzf.zzbi(Unknown Source:235)
at com.google.firebase.iid.zzf.zzt(Unknown Source:20)
at com.google.firebase.iid.zzf.zzbi(Unknown Source)
at com.google.firebase.iid.zzd.zzGu(Unknown Source:57)
at com.google.firebase.iid.zzd.getCreationTime(Unknown Source:49)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source:3)
at com.google.firebase.iid.FirebaseInstanceId.zzaae(Unknown Source:4)
at com.google.firebase.iid.FirebaseInstanceIdService.zzH(Unknown Source:37)
at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source:35)
at com.google.firebase.iid.zzb$2.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
I can't remove firebase from my project, is there other ways to solve this problem?
Fabric report
You should first try on the main menu, choose File | Invalidate Caches/Restart. this can happen if Android studio gets in a bad state.
It should also be noted that firebase is probably in play-services-analytics. Ever since google bought them out they have put firebase in many of their google play services libraries.

Firebase Crash produces ANR during launch

Recently I got feedback and also I was able to reproduce it easily on my Nexus 5 with cleared app data.
Simply, when adding compile 'com.google.firebase:firebase-crash:9.4.0' only to project dependencies I get following Exception:
09-14 00:47:54.899 3129-3129/com.szyk.myheart E/FirebaseCrash: Failed to initialize crash reporting
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
at bol.<init>(:com.google.android.gms.DynamiteModulesC:3201)
at com.google.firebase.crash.internal.api.FirebaseCrashApiImpl.init(:com.google.android.gms.DynamiteModulesC:67)
at bnu.onTransact(:com.google.android.gms.DynamiteModulesC:60)
at android.os.Binder.transact(Binder.java:387)
at com.google.firebase.crash.internal.zzd$zza$zza.zza(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.<init>(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.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:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
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)
The issue is more stranger, because once it will produce ANR and crash, then it works in next launches.
My dependencies:
compile 'com.google.firebase:firebase-core:9.4.0'
//not working compile 'com.google.firebase:firebase-crash:9.4.0'
compile 'com.google.firebase:firebase-invites:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-plus:9.4.0'
compile 'com.google.android.gms:play-services-drive:9.4.0'
The issue has been introduced with the Google Play Services 9.6.80 (currently in rollout) and affects all the apps using the Firebase Crash reporting (despite of the version bundled in your app).
Temporary solution: disable Firebase Crash by removing the following entry from the build.gradle:
compile 'com.google.firebase:firebase-crash:9.x.x'
Long term solution: wait that Google releases a fixed version of the GPS before enabling Firebase Crash again.
UPDATE 09/16:
Google is rolling out a fixed version of Google Play Services (9.6.83) which addresses the issue with Firebase Crash.
Disable the Firebase Analytics Crash Reporting, use the below code inside app.gradle file.Hope this will help you
configurations {
all*.exclude group: 'com.google.firebase', module: 'firebase-crash'
}
9.6.83 still gives a different anr crash
Our app when pushed to Play Store Beta and when installed on devices crashes the first time on launch. Subsequently it works , but we cannot push to prod without understanding the issue.
Here is the ANR crash report
java.lang.RuntimeException: Unable to instantiate receiver com.google.android.gms.analytics.CampaignTrackingReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.analytics.CampaignTrackingReceiver"
Edit : We had to add compile 'com.google.android.gms:play-services-analytics:9.4.0' explicitly and the launch anr for first time got resolved. But I am not sure that was the fix as we dont use the library at all. Maybe Playstore fixed their bug to all apks?
Just for the record:
We solved the DynamiteModulesC NPE and Uncaught exception in Firebase runloop (3.0.0) by removing following line
//remove this "feature" if you should use it
FirebaseApp.setAutomaticResourceManagmentEnabled(true)
API description:
If set to true it indicates that Firebase should close database
connections automatically when the app is in the background. Disabled
by default.
(Might be, that we missed some configurations for correct usage of this feature, but App is working as expected after not enabling the ResourceManagment)

Categories

Resources