1 year ago

#159045

test-img

Saehun Sean Oh

Latest Chromecast (21.0.1) produces crash from Android 12: ForegroundServiceStartNotAllowedException

Precondition

  1. targetSdkVersion and compileSdkVersion 31.
  2. com.google.android.gms:play-services-cast:21.0.1 and com.google.android.gms:play-services-cast-framework:21.0.1

Crash

Fatal Exception: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.ondemandkorea.android/com.google.android.gms.cast.framework.media.MediaNotificationService
       at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
       at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
       at android.os.Parcel.readParcelable(Parcel.java:3345)
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2432)
       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 android.app.IActivityManager$Stub$Proxy.startService(IActivityManager.java:6897)
       at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1926)
       at android.app.ContextImpl.startForegroundService(ContextImpl.java:1892)
       at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:796)
       at com.google.android.gms.cast.framework.media.internal.zzp.zzg(com.google.android.gms:play-services-cast-framework@@20.1.0:33)
       at com.google.android.gms.cast.framework.media.internal.zzp.onStatusUpdated(com.google.android.gms:play-services-cast-framework@@20.1.0:1)
       at com.google.android.gms.cast.framework.media.zzbo.zzm(com.google.android.gms:play-services-cast-framework@@20.1.0:4)
       at com.google.android.gms.cast.internal.zzap.zzaa(com.google.android.gms:play-services-cast@@20.1.0:1)
       at com.google.android.gms.cast.internal.zzap.zzQ(com.google.android.gms:play-services-cast@@20.1.0:65)
       at com.google.android.gms.cast.framework.media.RemoteMediaClient.onMessageReceived(com.google.android.gms:play-services-cast-framework@@20.1.0:1)
       at com.google.android.gms.cast.zzbn.run(com.google.android.gms:play-services-cast@@20.1.0:4)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8582)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:563)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)

I have seen similar SO posts like this or this, but those were caused by starting some foreground service manually.

As you can see in the stack trace, I'm not really starting any services myself. In fact, I don't even have startForegroundService() call in my codebase. It looks like Chromecast is doing the service implementation, but I don't know where to start to debug this. Someone reported an issue in the Chromecast github, but no one has replied.

If anyone experienced similar issue, please help me debug this (or reproduce the issue).

Thank you.

android

chromecast

android-12

0 Answers

Your Answer

Accepted video resources