Travis Reitter
01/25/2022, 7:48 AMiosMain, when viewed in Android Studio, have broken syntax highlighting and I get a warning that Kotlin is not configured. If I configure it for the module, I get some extra blocks added to my KMM module's Gradle file (as well as my Android app's Gradle file) which doesn't fix the syntax highlighting in the iosMain Kotlin files. It also breaks my Android app config and seems to make some other broken configuration (like adding classpath(kotlinModule("gradle-plugin", kotlin_version)) where kotlinModule can't be resolved) and adding androidx-core:core-ktx:+ and stdlib-jdk7 to my KMM module's dependencies (not just for androidMain)
What's the proper way to configure Kotlin for iosMain and fix the syntax highlighting?Travis Reitter
01/25/2022, 8:11 AMcommonMain has an expect class which I implement as an actual class in androidMain and iosMain. But there's a warning on the expect class that says:
"Class 'ClassName' has several compatible actual declarations in modules SharedModule, SharedModule"Travis Reitter
01/25/2022, 8:50 AMSharedModule Gradle file but I don't know exactly:
kotlin {
android()
val iosArm64 = iosArm64()
val iosX64 = iosX64()
val iosSimulatorArm64 = iosSimulatorArm64()
sourceSets {
val commonMain by getting {
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-common")
val kotlin_serialization_json_version = "1.3.1"
val doinst_x_normalize_version = "1.0.4"
val korlibs_krypto_version = "2.0.0.999"
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialization_json_version")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.0")
implementation("com.benasher44:uuid:$BENASHER44_UUID_VERSION")
implementation("com.doist.x:normalize:$doinst_x_normalize_version")
implementation("com.soywiz.korlibs.krypto:krypto:$korlibs_krypto_version")
implementation("com.squareup.sqldelight:runtime:$SQL_DELIGHT_VERSION")
}
}
val androidMain by getting {
dependsOn(commonMain)
dependencies {
implementation("com.squareup.sqldelight:android-driver:$SQL_DELIGHT_VERSION")
}
}
val iosMain by creating
val iosTest by creating
listOf(iosArm64, iosX64, iosSimulatorArm64).forEach {
it.binaries {
framework {
baseName = "SharedCode"
}
}
fun KotlinDependencyHandler.sharedImplementations() {
implementation("com.squareup.sqldelight:native-driver:$SQL_DELIGHT_VERSION")
}
getByName("${it.targetName}Main") {
dependsOn(iosMain)
dependencies {
sharedImplementations()
}
}
getByName("${it.targetName}Test") {
dependsOn(iosTest)
dependencies {
sharedImplementations()
}
}
}
}
}Travis Reitter
01/25/2022, 9:01 AMactual class in iosMain is described as belonging to MyProject.SharedCode.iosMain though the actual class in androidMain is in MyProject.SharedCode and the expect class is also in MyProject.SharedCode.Travis Reitter
01/25/2022, 9:20 PMios) based on environment variables to avoid creating multiple iOS targetsLukasz Burcon
02/09/2022, 7:55 AMAndroid plugin in Intellij, that allowed me to correctly index imports and classes usages