compose-macos-theme icon indicating copy to clipboard operation
compose-macos-theme copied to clipboard

java.lang.NoSuchFieldError: Normal and java.lang.NoSuchMethodError: 'androidx.compose.ui.Modifier'

Open ishiharas opened this issue 2 years ago • 3 comments

Hello,

at first, nice project. I tried the demo example and the look and feel of the ui-elements is quite nice.

I tried to use them in a freshly created demo kotlin-multiplatformm project and had some issues on the way.

Maybe you could help me or point me in a direction, how to fix the issue, because right now I spend some time on it and can't find, what the issue actually is.


Steps: At first, I created the project through intelliJs wizard and created a Kotlin Multiplatform project. Afterwards I updated all the dependencies, added your project and at last added a MacDropDown wrapped with a MacTheme.

The Result can be found here: https://github.com/ishiharas/compose-macos-theme


1: The first issue that transpired, occurred, when only adding an empty MacTheme composable. I got a java.lang.NoSuchFieldError: Normal exception. Looks like an issue with the Mac-fonts. (I use a MacBook with 11.2.2 Big Sur)

This can be prevented, when adding the default typography:

            MacTheme(typography = Typography()) {
            }

2: But after adding the MacDropDown component, I got another exception:

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: 'androidx.compose.ui.Modifier androidx.compose.foundation.ClickableKt.clickable$default(androidx.compose.ui.Modifier, androidx.compose.foundation.interaction.MutableInteractionSource, androidx.compose.foundation.Indication, boolean, java.lang.String, androidx.compose.ui.semantics.Role, kotlin.jvm.functions.Function0, int, java.lang.Object)'
	at io.chozzle.composemacostheme.MacDropdownKt$DropdownToggle$1.invoke(MacDropdown.kt:154)
	at io.chozzle.composemacostheme.MacDropdownKt$DropdownToggle$1.invoke(MacDropdown.kt:152)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
        [...]

The above mentioned code can be specifically found here: https://github.com/ishiharas/compose-macos-theme/blob/main/desktop/src/jvmMain/kotlin/Main.kt

ishiharas avatar Aug 09 '21 12:08 ishiharas

Which version of compose are you using? I haven't updated this to the latest yet

CarsonRedeye avatar Aug 09 '21 12:08 CarsonRedeye

The dependencies in my grade file are:

    dependencies {
        classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha3")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
        classpath("com.android.tools.build:gradle:4.2.1")
    }

ishiharas avatar Aug 09 '21 13:08 ishiharas

Ah it's only compatible with 0.4.0. I'll update tomorrow

CarsonRedeye avatar Aug 09 '21 15:08 CarsonRedeye