does anyone have an example of an MPP (not an app ...
# multiplatform
k
does anyone have an example of an MPP (not an app project) w/ an android library target?
interesting the first one created a main source set just to place AndroidManifest.xml
thanks! the second seems a little cleaner.
r
The Android plugin doesn't know how to read the manifest out of the multiplatform plugin's sourcesets, so you need to put the manifest in
main
instead of
androidMain
k
In the second one you need to map the kotlin source sets to where android expects them. See “4. Android Specific Configuration”. Both cases have some not-ideal config, but not horrible. I followed the multiplatform settings model yesterday and it worked quite well
Don’t forget
Copy code
android {
        publishAllLibraryVariants()
    }
k
yes, the second one is clear on that
the source sets that is
i am not seeing any discussion on publishAllLibraryVariants
r
It ensures that you publish both release and debug configurations
k
publish to where
r
as a maven dependency
ie as something that you'd import in your dependencies block
k
yeah i won't be publishing
at least not at first. perhaps to artifactory going forward.
r
Probably not a big deal yet then
k
gotcha. thanks.
seems to be working, but none of the IDE features work in the Android sources
no code completion, no auto-imports, no error highlighting
it doesn't even seem to understand that it is source code at all
yep - doesn't recognize it as a sources root
s
But if you expect a class in common does it ask you to create the actual class in the android side?
k
the compiler does
the IDE only informs me to create one in iosMain
s
hum
k
this may have happened because I started this project from a template that used jvm, and I switched it
s
I think the easiest is to create a new project with the default that gives you both an android and ios app
in intellij idea.. cant remember the exact name
k
I don't need apps. apps I have 🙂
s
then you delete the ios app and in build.gradle of the library
you change from application to library
yeah I know what you want to do
i'm doing something similar
k
i mean that's essentially the same thing I have done through a different path
interesting that that template doesn't create
androidMain
and
androidTest
, though it does specify dependencies for those source sets via the kotlin block in build.gradle
s
in my project I dont use those either
k
seems like this particular setup still needs some more thought from the Kotlin team
the android dependencies
I put them outside of kotlin
k
alright, thanks for the workaround
hah, making a change to build.gradle and rerunning the import fixed it
👍 1