Aymen Ben Salah
Aymen Ben Salah

Reputation: 509

java.lang.NoSuchMethodError: No direct method <init>(ZZLandroidx/compose/ui/window/SecureFlagPolicy;ZILkotlin

I'm trying to use Dialog android compose this code an i want the dialog full screen like this :

   Dialog(
        onDismissRequest = { },
        DialogProperties(
            usePlatformDefaultWidth = false,
            dismissOnBackPress = true,
            dismissOnClickOutside = false
        )
    )

Unfortunately this error appear :

   Process: com.app.app PID: 27584
    java.lang.NoSuchMethodError: No direct method <init>(ZZLandroidx/compose/ui/window/SecureFlagPolicy;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V in class Landroidx/compose/ui/window/DialogProperties; or its super classes (declaration of 'androidx.compose.ui.window.DialogProperties' appears in /data/app/~~eVwp2yK_fyWgL__UHhepqA==com.app.app-SKA9YfL5rl-chv6uDMdtgQ==/base.apk!classes21.dex)
     
 

Upvotes: 4

Views: 5537

Answers (3)

frodo2975
frodo2975

Reputation: 11775

I encountered this same error in an initializer, and for me the problem was I had accidentally imported the java forEach method instead of the Kotlin forEach. Updating the import fixed it, I'm commenting here in case anyone else comes across this same error.

Upvotes: 0

Tolga &#199;AĞLAYAN
Tolga &#199;AĞLAYAN

Reputation: 44

https://github.com/togisoft/jetpack_compose_country_code_picker

All problems have been fixed with the new update. You can check!

Upvotes: 1

claudio vieira
claudio vieira

Reputation: 1

I got the same error using this library:

com.github.togisoft:jetpack_compose_country_code_picker

This library calls internally the Dialog. On my build.gradle I just removed the material3 implementation:

androidx.compose.material3:material3:1.0.0-beta03

After I removed it started work properly again!

Upvotes: 0

Related Questions