Hi all, I'm trying to import a library with Jetpac...
# compose
l
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
Copy code
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).
s
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
My client code opens up an activity from the library that consumes compose views.
a
@nickbutcher @cb
c
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
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.
c
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
It does not. Looks like it brought in my library dependency but not any compose dependencies
256 Views