David Wasser
07/02/2024, 5:38 PMMichael Krussel
07/02/2024, 7:41 PMjava folder in the androidMain directory.David Wasser
07/02/2024, 8:22 PMjava folder isn't recognized as part of the source tree. The files don't get compiled. Also, just putting java source files in the kotlin folder in the source tree doesn't work either. They don't get compiled. I have a feeling that the Java compiler is only applied to the Jvm parts of the source tree, but I don't know why or how to change that behaviour.Michael Krussel
07/02/2024, 8:36 PMprivate fun Project.configureMultiplatformAndroidSources() {
(this.extensions.findByName("android") as? BaseExtension)!!.run {
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDir("src/androidMain/res")
sourceSets["test"].java.srcDir("src/jvmTestCommon/java")
sourceSets["test"].java.srcDir("src/androidUnitTest/java")
}
}
sourceSets["test"].java.srcDir("src/androidUnitTest/java") part let me do the java folder in the androidUnitTest so I thought it was just working. So you need to just add src/AndroidMain/java to Android's main java source directories.
In a gradle.build.kts file it would be
android {
sourceSets["main"].java.srcDir("src/androidMain/java")
}David Wasser
07/03/2024, 7:23 AMMichael Krussel
07/03/2024, 11:39 AM