我的应用程序的某些用户遇到崩溃,无法重现。接收此崩溃的用户只是一小部分,但目前是我要解决的应用程序中最大的崩溃。这是我在Firebase Crashlytics中收到的堆栈跟踪:
Fatal Exception: java.lang.IllegalArgumentException: Service not registered: com.android.systemui.qs.external.TileLifecycleManager@775810d
at android.os.Parcel.readException(Parcel.java:1947)
at android.os.Parcel.readException(Parcel.java:1889)
at android.service.quicksettings.IQSService$Stub$Proxy.updateQsTile(IQSService.java:215)
at android.service.quicksettings.Tile.updateTile(Tile.java:182)
at com.my.app.MyTileService.updateTile(SourceFile:110)
at com.my.app.MyTileService.onStartListening(SourceFile:83)
at android.service.quicksettings.TileService$H.handleMessage(TileService.java:407)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6592)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
崩溃仅发生在Android 8-9上。该崩溃出现在各种设备上,包括Google Pixel。奇怪的是,它在三星设备上不会发生。
MyTileService
类将覆盖方法onStartListening()
,然后调用updateTile()
。这是代码(科特琳):
package com.my.app
import android.service.quicksettings.TileService
...
class MyTileService : TileService() {
override fun onStartListening() {
super.onStartListening()
updateTile() // line 83
}
private fun updateTile() {
// qsTile is the same as calling getQsTile()
qsTile?.apply {
state = ...
label = ...
icon = ...
// Because of the way how Kotlin works, this calls qsTile.updateTile() and not the updateTile() method above.
updateTile() // line 110.
}
}
}