androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.61k stars 380 forks source link

RemoteServiceException #1044

Closed BoikoIlya closed 8 months ago

BoikoIlya commented 8 months ago

Version

Media3 1.2.1

More version details

sometimes i see in crashlitics crashes like that:

Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{4106886 u0 com.kamancho.melisma/.player.presentation.PlayerService} at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7700) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)

Fatal Exception: android.app.RemoteServiceException: Bad notification for startForeground at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2046) at android.app.ActivityThread.access$2900(ActivityThread.java:273) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2275) at android.os.Handler.dispatchMessage(Handler.java:106)

Fatal Exception: android.app.RemoteServiceException$CannotDeliverBroadcastException: can't deliver broadcast at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2090) at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2357) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:8115) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

Devices that reproduce the issue

First exception: Bird - FIH Foxconn P670 android 11, Huawei Honor 10 Lite android 10 Second: Transsion Tecno Pova 4 android 12 Third: Transsion Tecno android 13

Devices that do not reproduce the issue

n/d

Reproducible in the demo app?

Yes

Reproduction steps

n/d

Expected result

not crash

Actual result

crash

Media

n/d

Bug Report

oceanjules commented 8 months ago

Hi @BoikoIlya,

Could you please provide reproduction steps for this issue? What kind of media are you selecting in the demo app?

It is interesting that it doesn't work for Android 10, 11, 12 and 13. I found the following bug https://issuetracker.google.com/issues/245258072 and it looks like most people only struggle with Android 13. It's been marked as fixed, but there is some activity around it on SO.

It looks like a problem lower down and cannot be fixed by the Exoplayer team, so I will close this issue. Please see if the issue remains on the latest Android 14 version. If so, my best advice is to wait for AOSP to ship a bugfix.