firebase-android-sdk: SecurityException: Not allowed to bind to service

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android studio 4.0
  • Firebase Component: Messaging (Database, Firestore, Storage, Functions, etc)
  • Component version: 20.2.4

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

I am not able to reproduce the issue, mainly WIKO devices are affected by that one.

image

Relevant Code:

It seems that the Service cannot be bound due to security problems. I review my manifest permissions and I am including the com.google.android.c2dm.permission.RECEIVE permission, needed for the com.google.android.c2dm.intent.REGISTER intent.

Fatal Exception: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms }
       at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1741)
       at android.app.ContextImpl.bindService(ContextImpl.java:1651)
       at android.content.ContextWrapper.bindService(ContextWrapper.java:705)
       at com.google.android.gms.common.stats.ConnectionTracker.zza$3e27c581(ConnectionTracker.java:41)
       at com.google.android.gms.common.stats.ConnectionTracker.zza(ConnectionTracker.java:10)
       at com.google.android.gms.common.stats.ConnectionTracker.bindService(ConnectionTracker.java:43)
       at com.google.firebase.iid.MessengerIpcClient$Connection.startConnection(MessengerIpcClient.java:25)
       at com.google.firebase.iid.MessengerIpcClient$Connection.enqueueRequest(MessengerIpcClient.java:9)
       at com.google.firebase.iid.MessengerIpcClient.sendRequest(MessengerIpcClient.java:20)
       at com.google.firebase.iid.MessengerIpcClient.sendOneWayRequest(MessengerIpcClient.java:14)
       at com.google.firebase.messaging.FirebaseMessagingService.ackMessage(FirebaseMessagingService.java:102)
       at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent(FirebaseMessagingService.java:32)
       at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(FirebaseMessagingService.java:23)
       at com.google.firebase.messaging.EnhancedIntentService.lambda$processIntent$0$EnhancedIntentService(EnhancedIntentService.java:43)
       at com.google.firebase.messaging.EnhancedIntentService$$Lambda$0.run(EnhancedIntentService.java:2000)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.android.gms.common.util.concurrent.zza.run(zza.java:6)
       at java.lang.Thread.run(Thread.java:919)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 39
  • Comments: 56 (7 by maintainers)

Most upvoted comments

We’ve added a workaround that should stop it from crashing in version 17.0.0 of the play-services-cloud-messaging library. The next release of the FCM SDK should update to use that version of the library, including the workaround. You could try to add that version of the dependency directly, but I believe since the new version of the library contains a breaking change, you may run into incompatibilities with the current version of the FCM SDK and it may not build.

We see a huge spike of this crash from yesterday (Android 10, 96% Wiko devices). Any updates here?

Hi, we are also facing the same issue. Devices: 100% QMobile OS: 100% Android 10

Hi, We are also facing the same issue on QMobile. image

Yes, version 23.0.0 should include the workaround.

@gsakakihara Could you be so kind and clarify which version contains fix?

Hi @brunoescalona, and thanks for the bug report! We’re actively looking into similar reports (internal ref b/168922691) that seem to be affecting that same slice of devices, and this gives us another data point indicating it may be something device-specific. We haven’t settled on a solution just yet, but the team has proposed a couple of different ideas and hopefully we’ll have something to share here soon.

Hi there, we’re seeing the exact same issue on our end, with 5k+ crashes in the pat week.

Fatal Exception: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms }
       at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1741)
       at android.app.ContextImpl.bindService(ContextImpl.java:1651)
       at android.content.ContextWrapper.bindService(ContextWrapper.java:705)
       at com.google.android.gms.common.stats.ConnectionTracker.zza(ConnectionTracker.java:30)
       at com.google.android.gms.common.stats.ConnectionTracker.zza(ConnectionTracker.java:10)
       at com.google.android.gms.common.stats.ConnectionTracker.bindService(ConnectionTracker.java:39)
       at com.google.android.gms.cloudmessaging.zzf.zza(zzf.java:17)
       at com.google.android.gms.cloudmessaging.zze.zza(zze.java:18)
       at com.google.android.gms.cloudmessaging.zze.zza(zze.java:12)
       at com.google.android.gms.cloudmessaging.CloudMessagingReceiver.zzb(CloudMessagingReceiver.java:43)
       at com.google.android.gms.cloudmessaging.CloudMessagingReceiver.zza(CloudMessagingReceiver.java:59)
       at com.google.android.gms.cloudmessaging.zzd.run(zzd.java:10)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.android.gms.common.util.concurrent.zza.run(zza.java:6)
       at java.lang.Thread.run(Thread.java:919)

Also mainly on Wiko / Cat devices, all on Android 10:

Screen Shot 2021-04-14 at 4 48 14 PM

Any updates on this issue would be greatly appreciated

Same here.

Did anyone knows how to reproduce, we have a WIKO View4 Lite Android 10 here but can’t manage to reproduce it.

Screenshot 2021-07-26 at 09 41 09

Same

Screen Shot 2021-02-04 at 1 50 44 PM

Update (March 11): Still only happening on the same device, and still 100% occurring in background state.

@gsakakihara Do you mean the version com.google.firebase:firebase-messaging:23.0.0 that contains the workaround?

I’m no longer working at Google, but when I left this was on the team’s radar. I think maybe @gsakakihara may be able to provide an update on the status of b/168922691

getting 100% crash on Symphony android 10 devices

Getting the same crash on LG W31, W11 and LM-K610IM as well. Any update on this issue?

Same crash on 100% TINNO SUGAR T20,SUGAR T30, Android 10 device

Same issue seen on a HUAWEI ART-L29 running Android 9.

Same issue here. any workaround steps maybe? please update.

Same for me, crashed on Wiko View4

Is there any update on that issue?

Hello, We have the same problem in our app FranceTvSport It crashes on Wiko View4 , Wiko View4 Lite and Cat S42 and It is clear that your bug is still not fixed yet.
Can you please fix it or just respond to us. Many thanks !!

Hi! @ciarand could you push a bit this issue? Is one of our main crashes right now.

Hey @ciarand another 2 weeks passed, any updates? Anything that we could do to fix/work around/debug/help solving this issue? We are counting 50k crashes caused by this problem with our latest release.

Hey @ciarand , are there any updates on this issue? Maybe there is already some plan for a mitigation? Or maybe some way to work around and prevent that crash? This problem is the cause of 50% of all crashes we are seeing within our app.