I've got an existing KMM project that was created ...
# multiplatform
t
I've got an existing KMM project that was created by the wizard. I'd like to add another target to create another app for Android that uses the shared module. Are there any instructions on all the edits I need to make to the project files to add another target to an existing workspace? I expect not, but I figured I would ask before I attempt it.
m
Do you need another target or another project. Is the shared library already being built (target) for Android? If you are not already building for Android, you will need to call the
android
function in the Kotlin code block (similar to iOS, jvm, js). You will then need to add any specific android libraries to the android source set. If you just need the new app. Create a new module (Android Studio calls it a module, gradle calls it a project) Android Studio should have a wizard. Have that new module apply the kotlin-android plugin and not the kotln-multiplatform. Then add the shared library as a dependency using
implementation(project(":shared-lib"))
.
t
Thank you! There is already an Android project being built. I'll give it a shot.
This worked perfectly. Thanks again!