Kurt Renzo Acosta
03/05/2020, 1:36 AMMyClass
has several compatible actual declarations in modules module_iosX64Main, module_iosMain` , `Class MyClass
has several compatible actual declarations in modules module_iosArm64Main, module_iosMain`?
I'm trying to use the target shortcuts for iOS and my expect/actual declarations are having this error. Before I was using a switching mechanism between the device and simulator like this:
val iOSTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
::iosArm64
else
::iosX64
iOSTarget("ios") {
// config...
}
russhwolf
03/05/2020, 2:26 AMactual class MyClass
in iosMain
in addition to iosArm64Main
and iosX64Main
. Should either have separate declarations in the two different architecture sourceSets or a single definition in the shared one.Kurt Renzo Acosta
03/05/2020, 2:27 AMiosMain
, not in iosArm64Main
and iosX64Main
since their implementation is the sameX64
and Arm64
russhwolf
03/05/2020, 2:28 AMactual
in there?Kurt Renzo Acosta
03/05/2020, 2:29 AMrusshwolf
03/05/2020, 2:30 AMKurt Renzo Acosta
03/05/2020, 2:31 AMplugins {
id("com.android.library")
id("org.jetbrains.kotlin.multiplatform")
}
val KOTLIN_VERSION = "1.3.70"
val COROUTINES_VERSION = "1.3.3"
val frameworkName = "MultiplatformPaging"
android {
compileSdkVersion(29)
defaultConfig {
minSdkVersion(21)
targetSdkVersion(29)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
consumerProguardFiles("<http://consumer-rules.pro|consumer-rules.pro>")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
sourceSets {
getByName("main") {
manifest.srcFile("src/androidMain/AndroidManifest.xml")
java.srcDirs("src/androidMain/kotlin")
res.srcDirs("src/androidMain/res")
}
getByName("test") {
java.srcDirs("src/androidTest/kotlin")
res.srcDirs("src/androidTest/res")
}
getByName("androidTest") {
java.srcDirs("src/androidInstrumentedTest/kotlin")
res.srcDirs("src/androidInstrumentedTest/res")
}
}
}
kotlin {
ios {
binaries {
framework(frameworkName) {
baseName = frameworkName
}
}
}
android()
sourceSets["commonMain"].dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${COROUTINES_VERSION}")
}
sourceSets["iosMain"].dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${COROUTINES_VERSION}")
}
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$COROUTINES_VERSION")
implementation("androidx.paging:paging-runtime:2.1.1")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.2.0")
}
russhwolf
03/05/2020, 2:33 AMKurt Renzo Acosta
03/05/2020, 2:35 AMrusshwolf
03/05/2020, 2:36 AMKurt Renzo Acosta
03/05/2020, 2:44 AMkotlin.mpp.enableGranularSourceSetsMetadata=true
However, I remember that if you are using cocoapods with these, the libraries from pods won't be seen by the IDE. I haven't been able to verify if it still occurs now thoughandroidMain
source set though ☹️Artyom Degtyarev [JB]
03/05/2020, 10:20 AMKurt Renzo Acosta
03/05/2020, 10:23 AMArtyom Degtyarev [JB]
03/05/2020, 11:04 AMseveral compatible actual declarations
, which was not mentioned in the GH issue.Kurt Renzo Acosta
03/05/2020, 11:09 AMArtyom Degtyarev [JB]
03/05/2020, 11:17 AMkotlin.mpp.enableGranularSourceSetsMetadata=true
breaks the expect/actual highlighting in the AS, right? I’m feeling lost a bit as I’ve joined the discussion too late.