workspace/bottomsheetdialog-compose

Crash on Android 5 and 6 (API 22, 23)

Closed this issue · 2 comments

rAseri commented

First of all, thanks for the library! I'm trying to solve the same problem and this library looks like exactly what I need.

The problem is that the library doesn't work in Android with API levels 22 and 23. The app from your repository crashes on Android with these API versions.

Here is the stack trace:

Process: su.ati.common.sample, PID: 23247
android.util.AndroidRuntimeException: requestFeature() must be called before adding content
	at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:302)
	at com.holix.android.bottomsheetdialog.compose.BottomSheetDialogWrapper.<init>(BottomSheetDialog.kt:391)
	at com.holix.android.bottomsheetdialog.compose.BottomSheetDialogKt.BottomSheetDialog(BottomSheetDialog.kt:274)
	at su.ati.common.sample.compose.components.BottomSheetDialogDemoFragment.ScreenUi(BottomSheetDialogDemoFragment.kt:62)
	at su.ati.common.sample.compose.components.BottomSheetDialogDemoFragment.access$ScreenUi(BottomSheetDialogDemoFragment.kt:32)
	at su.ati.common.sample.compose.components.BottomSheetDialogDemoFragment$ScreenUi$2.invoke(BottomSheetDialogDemoFragment.kt)
	at su.ati.common.sample.compose.components.BottomSheetDialogDemoFragment$ScreenUi$2.invoke(BottomSheetDialogDemoFragment.kt)
	at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
	at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2375)
	at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2643)
	at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3260)
	at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3238)
	at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341)
	at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source)
	at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3238)
	at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3203)
	at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:771)
	at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1031)
	at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:125)
	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:534)
	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:503)
	at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
	at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
	at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
	at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:765)
	at android.view.Choreographer.doCallbacks(Choreographer.java:580)
	at android.view.Choreographer.doFrame(Choreographer.java:549)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5254)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

@rAseri sorry for being late. I'll investigate soon.

@rAseri Since we're using NoActionBar theme for the Dialog, there's no need to set FEATURE_NO_TITLE. I'll resolve this issue by removing it. It works well with API 23 and above

스크린샷 2023-08-11 오후 1 26 18