Skip to content

Crash when clicking on the phone number selector #3

Open

Description

java.lang.NoSuchMethodError: No static method BasicAlertDialog(Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/window/DialogProperties;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V in class Landroidx/compose/material3/AndroidAlertDialog_androidKt; or its super classes (declaration of 'androidx.compose.material3.AndroidAlertDialog_androidKt' appears in /data/app/~~sRe3WCvjfjscIqSE8eFYLg==/com.rockettrade.dev.noauth0-4yigOkQfmrRsb5yPYBNsBQ==/base.apk!classes18.dex)
at network.chaintech.cmpcountrycodepicker.ui.CountryPickerDialogKt.CountryDialog(CountryPickerDialog.kt:83)
at network.chaintech.cmpcountrycodepicker.ui.CountryPickerDialogKt.CountryPicker-HQhzCv8(CountryPickerDialog.kt:277)
at network.chaintech.cmpcountrycodepicker.ui.CountryPickerDialogKt.CountryPicker_HQhzCv8$lambda$21(Unknown Source:82)
at network.chaintech.cmpcountrycodepicker.ui.CountryPickerDialogKt.$r8$lambda$T9Kb0eCitbgxLxHL8nbj9ul15Uk(Unknown Source:0)
at network.chaintech.cmpcountrycodepicker.ui.CountryPickerDialogKt$$ExternalSyntheticLambda4.invoke(D8$$SyntheticClass:0)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2825)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3116)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3607)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3552)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:948)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1206)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:132)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:616)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:585)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
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:1299)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1309)
at android.view.Choreographer.doCallbacks(Choreographer.java:923)
at android.view.Choreographer.doFrame(Choreographer.java:847)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1283)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@7322dc6, androidx.compose.ui.platform.MotionDurationScaleImpl@7740187, StandaloneCoroutine{Cancelling}@a45f8b4, AndroidUiDispatcher@c9ecdd]

Implementation:

var selectedCountry: CountryDetails? by remember {
mutableStateOf(null)
}

var selectedCountryCode by rememberSaveable {
mutableStateOf("us")
}

CountryPicker(
defaultCountryCode = selectedCountryCode,
onCountrySelected = {
selectedCountryCode = it.countryCode
selectedCountry = it
}
)

Activity

  1. Bashirkhalil commented on Nov 20, 2024

    @Bashirkhalil

    You need to remove

    dependencies {
    implementation(libs.androidx.ui.android)
    implementation(libs.androidx.material3.android)
    debugImplementation(compose.uiTooling)
    }

    and added on android specific

  2. sevbanBayir commented on Mar 21, 2025

    @sevbanBayir

    @Bashirkhalil what if im already on a native android project ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions