firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.25k stars 573 forks source link

App crash while launch #4140

Closed lhx546920268 closed 1 year ago

lhx546920268 commented 1 year ago

App will crash while launch in device Redmi Note 7 android 10.0

Fatal Exception: java.lang.SecurityException: addOnPermissionsChangeListener: Neither user 10159 nor current process has android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS.
       at android.os.Parcel.createException(Parcel.java:2074)
       at android.os.Parcel.readException(Parcel.java:2042)
       at android.os.Parcel.readException(Parcel.java:1990)
       at com.google.android.gms.common.internal.zzac.getService(zzac.java:33)
       at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(BaseGmsClient.java:2)
       at com.google.android.gms.common.internal.BaseGmsClient$LegacyClientCallbackAdapter.a(BaseGmsClient.java:13)
       at com.google.android.gms.common.internal.zzg.zzd(zzg.java:6)
       at com.google.android.gms.common.internal.zza.a(zza.java:6)
       at com.google.android.gms.common.internal.zzc.zze(zzc.java:26)
       at com.google.android.gms.common.internal.zzb.handleMessage(zzb.java:26)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:224)
       at android.app.ActivityThread.main(ActivityThread.java:7590)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

google service

classpath 'com.google.gms:google-services:4.3.13'

firebase version

    implementation platform('com.google.firebase:firebase-bom:30.3.1')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-messaging-ktx'
google-oss-bot commented 1 year ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

argzdev commented 1 year ago

Hi @lhx546920268, thanks for reporting. Looking at your stacktrace, it doesn't seem like it's related to Firebase. Could you provide more details why you think this is an issue from Firebase? Also any chance you could provide a MCVE and steps to reproduce your issue? It'll greatly help us investigating this further. Thanks.

lhx546920268 commented 1 year ago

Hi @argzdev, sorry to reply too late. I think it's a firebase issue because the app doesn't crash when I remove implementation 'com.google.firebase:firebase-analytics-ktx'

If there is firebase-analytics, app will crash even i start an empty activity and application. The above problem is currently only found in Redmi Note 7, Redmi 8A android 10.0

There is a similar problem happened in device MI CC 9e android 10.0

Fatal Exception: java.lang.SecurityException: addOnPermissionsChangeListener: Neither user 10220 nor current process has android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS.
       at android.os.Parcel.createException(Parcel.java:2074)
       at android.os.Parcel.readException(Parcel.java:2042)
       at android.os.Parcel.readException(Parcel.java:1990)
       at bn.h(bn.java:11)
       at bk.a(bk.java:3)
       at bm.c(bm.java)
       at be.d(be.java:2)
       at bh.handleMessage(bh.java:28)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:225)
       at android.app.ActivityThread.main(ActivityThread.java:7560)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

when i upgrade firebase-bom from 28.0.1 to 30.3.1, it work well.

argzdev commented 1 year ago

Hi @lhx546920268, thanks for the extra details. Unfortunately, I can't test this on my side, since I do not have the said devices. However, I saw this Stack Overflow link that mentions specifying a MultiDexApplication might help resolving this issue. Could you try enabling multidex and see if it helps?

lhx546920268 commented 1 year ago

@argzdev ,I have used MultiDexApplication but it didn't work.

argzdev commented 1 year ago

Thanks for confirming, @lhx546920268. I'm wondering if this is related to this issue from Admob. It seems that the issue specifically points to thecom.google.android.gms.common package, which is included in the Google Play Service plugin. That said, could you file an issue on the Play Services Plugin repository? Also perhaps trying a previous version of the com.google.gms:google-services might help. Let me know if it helps. Thanks!

lhx546920268 commented 1 year ago

@argzdev I will try it.

HanteIsHante commented 1 year ago

I met the same problem, mainly on Android12 devices, HONOR & SAMSUNG:

Fatal Exception: java.lang.SecurityException: addOnPermissionsChangeListener: Neither user 10200 nor current process has android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS.
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2437)
       at android.os.Parcel.createException(Parcel.java:2421)
       at android.os.Parcel.readException(Parcel.java:2404)
       at android.os.Parcel.readException(Parcel.java:2346)
       at com.google.android.gms.common.internal.IGmsServiceBroker$Stub$zza.getService(IGmsServiceBroker.java:14)
       at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(BaseGmsClient.java:263)
       at com.google.android.gms.common.internal.BaseGmsClient$LegacyClientCallbackAdapter.onReportServiceBinding(BaseGmsClient.java:3)
       at com.google.android.gms.common.internal.BaseGmsClient$zzg.zza(BaseGmsClient.java:10)
       at com.google.android.gms.common.internal.BaseGmsClient$zza.zza(BaseGmsClient.java:12)
       at com.google.android.gms.common.internal.BaseGmsClient$zzc.zzc(BaseGmsClient.java:11)
       at com.google.android.gms.common.internal.BaseGmsClient$zzb.handleMessage(BaseGmsClient.java:49)
       at android.os.Handler.dispatchMessage(Handler.java:109)
       at com.google.android.gms.internal.common.zzi.dispatchMessage(zzi.java:8)
       at android.os.Looper.loopOnce(Looper.java:206)
       at android.os.Looper.loop(Looper.java:296)
       at android.app.ActivityThread.main(ActivityThread.java:8971)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:976)

Library version used:

classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.gms:google-services:4.3.14' implementation platform('com.google.firebase:firebase-bom:31.1.0')

I'm generating a lot of crashes, which seriously affects the crash rate

argzdev commented 1 year ago

Hi @HanteIsHante, what Firebase products are you currently using?

argzdev commented 1 year ago

Looks like this issue has been resolved. I'll be closing this now. Feel free to ask this to be reopened if there any extra information that indicates that the issue is due to Firebase, then we can investigate this further. Thanks!