Hello, World! Does anyone know if it's possible t...
# multiplatform
b
Hello, World! Does anyone know if it's possible to have a MP project that both publishes an Android library artifact (.aar), and contains an Android app sample. It appears to me that I find samples that either apply the
com.android.library
gradle plugin (to publish an aar artifact) or the
com.android.application
one (to have a sample app) - but of course you can't apply both. Ideas?
b
That was possible with the old MPP plugins, where each target is a separate module rather than a sourceSet. Not so sure now 😕
s
Build your aar in common as a library. Then you can have an application project that consumes that module and expose the application through that. What is it you are trying to achieve exactly?
b
well I'm trying to have a MP library to be consumed by Android and iOS and it would be nice if it contained a sample app in such a way that if I open the project in the IDE, I can just run the app. Instead of having a separate sample app project.
I think @Sean Keane you're saying that it should be a separate project, right?
s
All you need is a separate module
b
oh! of course 🙂
didn't think of that
s
You can run the app from the app module and use your common code between both
b
perfect 🙂 Thanks a lot
b
Not really. I had same issue with the MPP library I'm working on as well. What I did was just a separate gradle module for the app that depends on the lib via
implementation(project(":libModuleName"))
b
yeah that makes sense now that I think of it 🙂
s
^ yep. Separate module for the application that implements the library
b
👍 thanks all!
👍 1