https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

JoakimForslund

12/02/2019, 1:36 PM
Question, I'm using Kotlin Multiplatform 1.3.50. I'm trying to move away from running android in a multiplatform-library under the folder
main
into
androidMain
I've added this onto the android-library extension:
Copy code
sourceSets.forEach {
        val root = "src/androidMain/${it.name}"
        val manifestFile = file("src/androidMain/AndroidManifest.xml")
        it.setRoot(root)
        it.java.setSrcDirs(fileTree("${root}/kotlin"))
        it.manifest.srcFile(manifestFile)
    }
which seems to at least make everything look in the right place. However, now my
expect/actual
in my common starts to complain that it can not find the actual implementation for jvm set up, which is weird, because I have not setup a target for jvm, and the implementation it should be looking for, does exist within the
androidMain
folder, but it does not look for it there, how can I change that?
s

Sebastian Sellmair [JB]

12/02/2019, 2:26 PM
You can try to verify your sourceSets using ./gradlew sourceSets
Maybe you see some path being wrong.
Are you sure, that root does not need to be an absolute path for example?
Oh wait root is something like “src/androidMain/main/ While your java src dirs are then “src/androidMain/main/kotlin” instead of “src/androidMain/kotlin”. Probably your root should just be “src/androidMain”
You might also want to have a quick look into this PR ☺️ https://github.com/JetBrains/kotlin/pull/2829
j

JoakimForslund

12/02/2019, 2:42 PM
Yeah, you are correct, those paths does not look correct at all
That seems to solve it, thanks for giving a helping hand 🙂
s

Sebastian Sellmair [JB]

12/02/2019, 2:49 PM
☺️ 👍
2 Views