android - 谷歌cast MediaNotificationService 中的大量RemoteServiceExceptions

标签 android google-play-services chromecast foreground-service

在过去的约 24 小时内,我们在 Google 的 MediaNotificationService 中看到了数千次崩溃。 :

Fatal Exception: android.app.RemoteServiceException
    Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{f9a4deb u0 <our package name>/com.google.android.gms.cast.framework.media.MediaNotificationService}
    android.app.ActivityThread$H.handleMessage (ActivityThread.java:1855)
    android.os.Handler.dispatchMessage (Handler.java:106)
    android.os.Looper.loop (Looper.java:214)
    android.app.ActivityThread.main (ActivityThread.java:6986)
    java.lang.reflect.Method.invoke (Method.java)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
    com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1445)

我在创建自己的前台服务时遇到了类似的问题,但由于这是在 Actor 库中,我们无法控制它。

Chromecast 接收器由第三方处理。我们正在使用:
api "com.google.android.gms:play-services-cast:17.0.0"
api "com.google.android.gms:play-services-cast-framework:17.0.0"

潜在线索:
  • 它发生在 OnePlus、华为、三星、谷歌,似乎每个制造商(和操作系统级别)的数量都与其市场份额相关。
  • 崩溃发生在不同设备的不同线路上(例如,上面是 Galaxy S9,而 S8 则在 1872 行崩溃),因此在 Crashlytics 上没有组合在一起。这向我表明这是一个操作系统/谷歌播放服务级别的问题。
  • 崩溃发生在应用程序的所有 Activity 版本中,同时开始。
  • 几个月来,坠机事故的发生率一直很低,但在周末突然飙升,而且没有放缓的迹象。

  • 更新 : 终于成功重现了。在屏幕锁定的情况下长时间转换内容,然后与设备断开连接时,会发生崩溃。也许离解决方案又近了一步……

    最佳答案

    看起来像 a known issue :

    Issue occured only on HUAWEI devices with Android 9 : P20 pro, P30 pro, P20 lite, P30, P20, Honor View 10, Mate 20 pro

    Cast SDK version : Android Sender 16.2.0 (I checked release notes of Android Sender 17.1.0 but no bug fixes)

    Here is the crash log from fabric :


    Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{3ac0035 u0 com.google.android.gms.cast.framework.media.MediaNotificationService}
           at android.app.ActivityThread$H.handleMessage + 2126(ActivityThread.java:2126)
           at android.os.Handler.dispatchMessage + 112(Handler.java:112)
           at android.os.Looper.loop + 216(Looper.java:216)
           at android.app.ActivityThread.main + 7625(ActivityThread.java:7625)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 524(RuntimeInit.java:524)
           at com.android.internal.os.ZygoteInit.main + 987(ZygoteInit.java:987)
    

    a Google engineer says is fixed :

    We have a fix for this and that should be released by the next Android Cast client library release.



    但是 they don't know when the fix will be released :

    So far we don't have a solid date when the next release will be scheduled. We will update it here or else please do check here https://developers.google.com/cast/docs/release-notes



    release notes不要提及对此的修复。

    如果我发现任何进一步的信息,我会更新这个答案。

    更新

    这是固定的。见 Anjaneesh 's answer .

    更新
    18.0.0 存在一些问题.见 rednaz 's answer .
    此外,该问题的评论者仍然遇到 Samsung 的崩溃。和 Huawei平台,但价格大大降低。我提交了 new issue对这个。

    关于android - 谷歌cast MediaNotificationService 中的大量RemoteServiceExceptions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60148919/

    相关文章:

    android - 当设备安装更高版本的 Android 时,Settings.Secure#ANDROID_ID 会重置吗?

    java - Android等待picasso完成

    android - API 项目在 Google Developers Console 中缺少项目 ID

    android - Google Play 服务无法验证,操作 : SIGN_IN status: 10

    javascript - 在 Cocos2d-JS 中使用 Google Play 服务

    android - 使用 CastPlayer 更改字幕

    java - 我的 2d Android 游戏遇到问题

    Android 3.0 日历 View

    javascript - 在 Chromecast Custom Receiver 上显示图像

    android - 无法获得哪个 Android 版本支持 chromecast 应用程序的答案