Hi everyone, I have made a KMM library that uses c...
# multiplatform
a
Hi everyone, I have made a KMM library that uses compose multiplatform and uses material 3 components. The issue is when I am use this library in my android project that is already using jetpack compose I am getting this error
Copy code
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
c
I had a case where the Jetpack Compose function was taking different parameters than then Compose Multiplatform function. Both were called the same, but the parameters were different. The IDE didn’t recognize that due to the way the dependencies were loaded. I am not sure if this is still possible in some cases, but could be the reason. If that is not the case, doublecheck your dependencies and make sure you are not mixing Material (old) with Material 3. If your Android project uses the Jetpack Compose and the library with Compose Multiplatform, you should make sure that you are loading the same versions and generally avoid if possible using both in a project and in the same module, since it makes it harder to maintain and troubleshoot the project. With a reproduction code it may be easier to tell what is wrong and how to fix it. P.S. for compose-only related topics prefer the #compose channel. It is dedicated to Jetpack Compose and Compose MP topics like yours.
a
Thanks for the help, as you also said , there was some issue with some of the material3 elements like Textfiled , while other components are working fine. I don’t know the exact reason but assuming it versions issue, I have replace material3 TextField with material TextField for now and it’s working fine