l

    Lauren Yew

    1 year ago
    Hi all, I'm trying to import a library with Jetpack compose
    1.0.0-beta01
    (Android Gradle plugin 7.0.0-alpha09) into an app that doesn't have jetpack compose and android gradle plugin 4.1.0. I'm getting an error
    java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/runtime/internal/ComposableLambdaKt;
    when I try to open up my compose views from the library. Has anyone seen this kind of issue before / know a fix? I thought compose could be used in a library only and then not be required for the app (my client app has product requirements limiting it from updating the AGP / going to compose).
    steelahhh

    steelahhh

    1 year ago
    How does your client code consume the library’s compose views? From my experience, If you’re trying to directly call the Composable functions - that won’t work. So what you have to do is wrap the Composable in a custom Android view with ComposeView/AbstractComposeView, and expose that from the library (without any reference to compose)
    l

    Lauren Yew

    1 year ago
    My client code opens up an activity from the library that consumes compose views.
    a

    Anastasia [G]

    1 year ago
    @nickbutcher @cb
    cb

    cb

    1 year ago
    When you say 'library', is this a library module in the same project? Or an AAR distributed over Maven/etc
    Sounds like the Gradle app module isn't picking up the Compose transisitive dependencies, but that's a total guess
    l

    Lauren Yew

    1 year ago
    It's a library AAR distributed over mavenLocal
    @cb any updates on this?
    I've tried using
    implementation
    and
    api
    with the build.gradle. Both result in the same error.
    cb

    cb

    1 year ago
    I don't really have an update for you tbh. Difficult to know what the issue is without looking at the code. Does
    .gradlew androidDependencies
    list any Compose dependencies?
    l

    Lauren Yew

    1 year ago
    It does not. Looks like it brought in my library dependency but not any compose dependencies