Hello, I am working on a compose multiplatform pro...
# multiplatform
m
Hello, I am working on a compose multiplatform project and the app was working fine until I ran it again today, it is giving this weird error
No static method OutlinedTextField
though nothing has changed since last successful run. Also, the iOS build is running smoothly and it is just when I try to run the android app. Has anyone faces this issue before?
Copy code
E  FATAL EXCEPTION: main  Process: app.mobile.way.android, PID: 28647
java.lang.NoSuchMethodError: No static method OutlinedTextField(Ljava/lang/String;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Modifier;ZZLandroidx/compose/ui/text/TextStyle;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;ZLandroidx/compose/ui/text/input/VisualTransformation;Landroidx/compose/foundation/text/KeyboardOptions;Landroidx/compose/foundation/text/KeyboardActions;ZILandroidx/compose/foundation/interaction/MutableInteractionSource;Landroidx/compose/ui/graphics/Shape;Landroidx/compose/material3/TextFieldColors;Landroidx/compose/runtime/Composer;III)V in class Landroidx/compose/material3/OutlinedTextFieldKt; or its super classes (declaration of 'androidx.compose.material3.OutlinedTextFieldKt' appears in /data/app/~~z1H6WQur-uLWZAppJZTRGQ==/app.mobile.way.android-fI8R4eojs-KfoRgoU4ZVIQ==/base.apk)
Also, tried running without KeyboardOptions in the OutlinedTextField. And changed OutlinedTextField to TextField with only
value
&
onValueChange
options..but that doesn't seem to work
j
Do you have compose enabled in the module?
This usually happens when the compiler is not running
m
Yes, it is enabled and the iOS configurations is running without issues...it's only happening in android configuration
Also, this is a runtime error and if I comment out the
OutlinedTextField
it works or goto a screen where there is no
OutlinedTextField
it works....which also implies that there aren't any issues with the compiler?
j
Was just a guess based on the extremely limited information you provided. Don't know then.
j
Interesting that the iOS build does work. Could it be a minification issue that strips away a bit too much on Android? The other Compose code that does work, is that in the same module & source set as the breaking one?
m
I have minification disabled and yes the other compose code is in same module / source set as the breaking one
Update: This answer HERE helped and rolling back the compose bom in android module solved the issue. I guess it's due to incompatibility between multiplatform compose and jetpack compose versions
j
Ahh, so that explains it! The multiplatform version probably had a slightly different version of
OutlinedTextField
. Glad you found it, thanks for sharing!
👍 1
a
Great that you found it. But you said that everything worked fine and nothing has changed. Was that still the case?
m
Yes, that's the weird thing about this. I checked out from the last successful build for both android and iOS and it didn't work until I rolled back the compose-bom to an older version for android module
220 Views