dokar3 / ChipTextField

Editable chip layout for Compose Multiplatform
Apache License 2.0
82 stars 3 forks source link

java.lang.NoSuchMethodError: No virtual method containerColor$material3_release #145

Closed EdricChan03 closed 2 months ago

EdricChan03 commented 2 months ago

Trying to use your ChipTextField M3 composable with the latest alpha version of Compose Material3 (1.3.0-alpha04) in my application results in the following runtime exception:

FATAL EXCEPTION: main

Process: com.edricchan.studybuddy.debug, PID: 15038

java.lang.NoSuchMethodError: No virtual method containerColor$material3_release(ZZLandroidx/compose/foundation/interaction/InteractionSource;Landroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; in class Landroidx/compose/material3/TextFieldColors; or its super classes (declaration of 'androidx.compose.material3.TextFieldColors' appears in /data/app/~~vbA7OQNACTyE_6u8mGXFWA==/com.edricchan.studybuddy.debug-Bon-hhim6VYMu3d0aAH8JA==/base.apk)
at com.dokar.chiptextfield.m3.TextFieldColorsConverterKt$toChipTextFieldColors$1.backgroundColor(TextFieldColorsConverter.kt:38)
at com.dokar.chiptextfield.m3.OutlinedChipTextFieldKt.OutlinedChipTextField-oTzSxmA(OutlinedChipTextField.kt:273)
at com.dokar.chiptextfield.m3.OutlinedChipTextFieldKt.OutlinedChipTextField-oTzSxmA(OutlinedChipTextField.kt:186)
...

Looking at the source code, I believe this is because the containerColor method that's used in the TextFieldColorsConverter.kt file has since been made to return a Color rather than a State<Color>:

https://github.com/dokar3/ChipTextField/blob/d821f25ef5aef4db4c6ec27298f8d7127ad1b865/chiptextfield-m3/src/commonMain/kotlin/com/dokar/chiptextfield/m3/TextFieldColorsConverter.kt#L32-L43

(I presume this change most likely landed in 1.3.0-alpha02, but there's no user-facing release note so I can't confirm that)

dokar3 commented 2 months ago

Thanks for reporting. Material 3 1.3 seems to have changed a lot, will patch a fix later.

dokar3 commented 2 months ago

The fix is out, it should work now, feel free to try it! https://github.com/dokar3/ChipTextField/releases/tag/v0.7.0-alpha03