Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Attachment actions
Unintended behavior
View staffing
Description
Version used: 1.0.0-alpha05
Devices/Android versions reproduced on: ANy wear os
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).
I have an app with Compose Glance Tile Service. When I delete tile from wear device, I see crash and an error.
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ClassCastException: kotlinx.coroutines.StandaloneCoroutine cannot be cast to android.content.Context
at androidx.glance.wear.tiles.GlanceTileService$onTileRemoveEvent$1.invokeSuspend(GlanceTileService.kt:331)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:367)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
at androidx.glance.wear.tiles.GlanceTileService.onTileRemoveEvent(GlanceTileService.kt:329)
at androidx.wear.tiles.TileService$TileProviderWrapper.lambda$onTileRemoveEvent$5$androidx-wear-tiles-TileService$TileProviderWrapper(TileService.java:363)
at androidx.wear.tiles.TileService$TileProviderWrapper$$ExternalSyntheticLambda1.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.BroadcastFrameClock@95c10e4, StandaloneCoroutine{Cancelling}@db0d94d, Dispatchers.Main.immediate]
After checking source code, I have found this function
@CallSuper
override fun onTileRemoveEvent(requestParams: TileRemoveEvent) {
coroutineScope.launch {
stateDefinition?.let {
GlanceState.deleteStore(this as Context, it, getStateIdentifier())
}
}
}
this as Context take this from coroutineScope.launch {, which I think is an error.
I understand that library in alpha version, but I think this bug should be fixed.
Thank you