glance-experimental-tools
glance-experimental-tools copied to clipboard
[AppWidget Viewer] NoSuchMethodError: No static method ModalBottomSheetLayout
Describe the bug
The project is currently using outdated version of many dependencies, including Compose and Glance. This is causing crashes like the following:
java.lang.NoSuchMethodError: No static method ModalBottomSheetLayout-BzaUkTc(Lkotlin/jvm/functions/Function3;Landroidx/compose/ui/Modifier;Landroidx/compose/material/ModalBottomSheetState;Landroidx/compose/ui/graphics/Shape;FJJJLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V in class Landroidx/compose/material/ModalBottomSheetKt; or its super classes (declaration of 'androidx.compose.material.ModalBottomSheetKt' appears in /data/app/com.leinardi.ubuntucountdownwidget.debug-1/base.apk)
at com.google.android.glance.tools.viewer.ui.ViewerScreenKt.ViewerScreen-_ngmBi8(ViewerScreen.kt:118)
at com.google.android.glance.tools.viewer.AppWidgetViewerActivity$onCreate$1$1$1.invoke(GlanceViewerActivity.kt:95)
at com.google.android.glance.tools.viewer.AppWidgetViewerActivity$onCreate$1$1$1.invoke(GlanceViewerActivity.kt:94)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:133)
at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:114)
[...]
To Reproduce
Steps to reproduce the behavior:
- Use the viewer library with the latest version of Compose and Material 3.
Expected behavior
The viewer should work as expected
Environment:
- Android OS version: API 24
- Device: Emulator
- Glance Experimental Tools version: 0.2.2
Additional context
I would be happy to work on a PR that bumps the dependencies but, before investing effort on it, I would like to have a confirmation that it would be appreciated and merged if successful.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Remove stale label or comment or this will be closed in 5 days.
A fix is getting worked on but isn't released yet: https://issuetracker.google.com/issues/298066147#comment3
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
I've updated the PR #13 to update to the latest dependencies, would it be possible to review it, merge it and make a new release of the libraries? The artifacts on Maven Central are still very outdated.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days
.. and does anyone solve this problem :'(
@ienground #13
still not working :'(
do you get the same error java.lang.NoSuchMethodError: No static method ModalBottomSheetLayout
?
when I launch GlancePreviewActivity (implements GlanceViewerActivity), it terminated with message:
FATAL EXCEPTION: main (Ask Gemini)
Process: zone.ien.calarm.debug, PID: 31900
java.lang.NoSuchMethodError: No static method ModalBottomSheetLayout-BzaUkTc(Lkotlin/jvm/functions/Function3;Landroidx/compose/ui/Modifier;Landroidx/compose/material/ModalBottomSheetState;Landroidx/compose/ui/graphics/Shape;FJJJLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V in class Landroidx/compose/material/ModalBottomSheetKt; or its super classes (declaration of 'androidx.compose.material.ModalBottomSheetKt' appears in /data/app/~~pVUrzfKR-8_D2u7-Lfzplg==/zone.ien.calarm.debug-dskKyv1EuMRGdwqN8mq4_Q==/base.apk) at com.google.android.glance.tools.viewer.ui.ViewerScreenKt.ViewerScreen-_ngmBi8(ViewerScreen.kt:118)
at com.google.android.glance.tools.viewer.AppWidgetViewerActivity$onCreate$1$1$1.invoke(GlanceViewerActivity.kt:95)
...
my activity:
@OptIn(ExperimentalGlanceRemoteViewsApi::class)
class GlancePreviewActivity: GlanceViewerActivity() {
@ExperimentalGlanceRemoteViewsApi
override suspend fun getGlanceSnapshot(receiver: Class<out GlanceAppWidgetReceiver>): GlanceSnapshot {
return when (receiver) {
AnalogClockWidgetReceiver::class.java -> GlanceSnapshot(
instance = AnalogClockWidget(),
// state = mutablePreferencesOf(intPreferencesKey("state") to value)
)
else -> throw IllegalArgumentException()
}
}
@ExperimentalGlanceRemoteViewsApi
override fun getProviders(): List<Class<out AppWidgetProvider>> {
return listOf(AnalogClockWidgetReceiver::class.java)
}
}
but are you actually using the code from the PR #13 instead of the Maven Central artifact of this library?
to be honest, your code works only if I add material (compose material2) library. Without it, It is not compiling.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
comment or this will be closed in 5 days