I'm trying to fix an open source library I created...
# compose
c
I'm trying to fix an open source library I created that uses TextFieldValue from compose-ui for a parameter. However, importing and using the Composable from the artifact on Maven Central gives the following error. From online reports, it would seem that this type of error usually happens when the compose version is not specified or if compose is not enabled. However, I have provided both as shown below in both the library and the example code module. What are some likely reasons why the runtime would fail to resolve the Composable as a method?
Copy code
java.lang.NoSuchMethodError: No static method MarkdownEditor$default(...
relevant build.gradle lines in both library and example app modules:
Copy code
android {
// ...
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions.jvmTarget = "1.8"
    buildFeatures.compose = true
    composeOptions.kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
Removing TextFieldValue and the compose-ui api depdendency from the picture does not seem to resolve this issue.
I'm clearly missing something else required of a Composable library
a
Have faced similar issues, mostly occurs due to version mismatch is your library compose version and app version same ? and still it's crashing
c
It should be. They're both using the same version catalog.
p
Do you explicitly specify compose-runtime, compose-ui, compose-foundation and compose-mateeial?
c
I'll check in a bit. That's a good call out.
I seem to have been missing compose-runtime in my version catalog bundle, but adding it didn't resolve the issue even after republishing the artifacts. I had previously been using compose-bom, but I read that this can cause problems if the end user specifies a different version of a dependency than the BOM and removed it. The code also wasn't working before I'd removed the BOM from both modules. I guess I'll look over the actual dependencies tree and see if anything is using an unexpected version that I didn't specify.
1
I just pushed the latest code: https://github.com/colintheshots/MarkdownTwain It works if I use the project dependency, but fails if I use the Maven Central artifact.
Sigh. I figured it out. Proguard was enabled.
sweating 1