Crash on Android 8 in Android SDK 1.4.2
답변함Using the latest version of the Zopim SDK on Android (1.4.2), we noticed a crash which happens only on Samsung devices running Android 8:
Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1881)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374
-
Hi Romain,
Sorry for the delay. Is this crash happening a lot when seen as a percentage of active sessions? I was reading about this exception and it appears to happen if there's a 5+ second delay between the calls to Context.startForegroundService() and Service.startForeground(). Are they specific Samsung devices, or all of them?
Thanks
-
The device here is not the cause of the problem in os
-----------------------------------------------------------------------------------------
Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{a6a3e3d u0 app/com.zopim.android.sdk.widget.ChatWidgetService}
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1835)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) -
Hi Barry,
The issue seems to happen on a small proportion of our user base but still enough to be noticed. It's currently 100% of Samsung devices running Android 8:
-
Thanks Romain, we'll discuss it here and figure out the next steps.
-
Hi Barry, do you have any update on this? We're seeing a lot of crashes with this stacktrace in our latest versions.
It also happens on other devices with a different stacktrace:
Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground():
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1745)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) -
I think adding
startForeground()
on API 26+ inonCreate()
for ChatService should fix it. See https://stackoverflow.com/questions/44425584/context-startforegroundservice-did-not-then-call-service-startforeground -
Thanks Romain, we have investigating it planned for the next sprint.
-
Hey Romain,
We pushed out a version to help. We think it'll fix it, although it wasn't something we could reproduce.
https://developer.zendesk.com/embeddables/docs/android-chat-sdk/releasenotes#version-1.4.3
-
Hi Barry, that's great, thanks!
-
Hi Barry, unfortunately the latest update (1.4.3) didn't seem to fix the issue. We are still seeing many crashes with the same stacktrace:
Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{cdc53d2 u0 app/com.zopim.android.sdk.widget.ChatWidgetService}
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2050)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:7470)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)Looking at the code, I'm not sure why it happens. We don't do anything fancy with the ChatWidgetService apart from disabling it when our activity starts: ChatWidgetService.disable().
Why does the service needs to run even when disable() gets called? I see that it gets started from the ZopimChatActivity, ZopimChatLogFragment and other fragments, couldn't we check if it's enabled before we start it? That wouldn't fix the problem but it would work around it for the apps which don't need the chat widget.
Let me know if you need more details.
-
Hi Romain,
Sorry to hear the issue still persists after the fix has been rolled out. Let me open a ticket for you in order to discuss this case further with our Product Manager. We will reach out to you there shortly!
Best regards,
Valeriya
-
This issue is back with our engineers and we'll be taking another look.
Thanks,
Dan
-
Hi. Did you find a way how to fix this issue? If yes could you share your experiences with other developers? I have the same issue and I can't find answer why it happens on Samsung devices.
I started a thread on StackOverflow about this issue https://stackoverflow.com/questions/55653373/context-startforegroundservice-did-not-then-call-service-startforeground-on
Could you complement my question with additional information if you have them.
-
I created issue here https://support.zendesk.com/hc/en-us/community/posts/360034232754-Crash-at-Android-9-SDK-1-4-5
Also we have same crash at some devices with Android 8.
댓글을 남기려면 로그인하세요.
14 댓글