Cristián Arenas
01/03/2020, 2:00 PMunresolved reference: platform
on Android Studio in my iosMain
files, unless I add this:
iosX64Main {
…
kotlin.srcDirs += project.file("src/iosMain/kotlin")
}
iosArm64Main {
…
kotlin.srcDirs += project.file("src/iosMain/kotlin")
}
(I can generate the library though, so it seems the problem is with Android Studio)
But if I add that, then it starts expecting new actuals: expected class 'X' has no actual declaration in module my-app_iosX64Main for Native
Kris Wong
01/03/2020, 2:02 PMCristián Arenas
01/03/2020, 2:13 PMiosX64('ios')
ios
should be creating targets for iosArm64 and iosX64
and that I should create an intermediate source set (iosMain) and configuring links between it and the platform source sets
.
While here it seems I’m changing the name of the iosX64
target to ios
and using that as a base to build iosArm64
, which sounds wrong… as I have different dependencies for both targetsErik Christensen
01/03/2020, 2:26 PMCristián Arenas
01/03/2020, 2:27 PMKris Wong
01/03/2020, 2:28 PMCristián Arenas
01/03/2020, 2:29 PMKris Wong
01/03/2020, 2:29 PMCristián Arenas
01/03/2020, 2:30 PMiosX64
to ios
not mess up my dependencies?
I have most dependencies on iosMain
, but then iosX64Main
and iosArm64Main
(each dependsOn
iosMain
) add some extra architecture-specific dependenciesErik Christensen
01/03/2020, 2:33 PMCristián Arenas
01/03/2020, 2:33 PMiosMain
change if I rename iosX64
to ios
?Erik Christensen
01/03/2020, 2:34 PMiosMain
becomes the target's source set rather than a shared source set between targets when you do thatCristián Arenas
01/03/2020, 2:35 PMyou can check for a Gradle property that indicates that IDEA is active and setup your targets so as to avoid having a shared source set just in that contextHow do you do that? where can I read more about it?
Erik Christensen
01/03/2020, 2:37 PMCristián Arenas
01/03/2020, 2:38 PMideaActive
be true if I launch a gradle task from Android Studio?Erik Christensen
01/03/2020, 2:42 PMCristián Arenas
01/03/2020, 2:43 PMErik Christensen
01/03/2020, 2:45 PMCristián Arenas
01/03/2020, 2:48 PM// You may uncomment this line for autocompletion to work on Android Studio
//iosX64('ios') // DO NOT COMMIT THIS UNCOMMENTED LINE
Kris Wong
01/03/2020, 2:48 PMiosMain
as the target's source set?Cristián Arenas
01/03/2020, 2:51 PMI have most dependencies on iosMain, but then iosX64Main and iosArm64Main (each dependsOn iosMain) add some extra architecture-specific dependenciesSo if Erik’s statement is true:
iosMain becomes the target’s source set rather than a shared source set between targets when you do thatThat would mean that iosArm64 could contain iosX64 specific code
Kris Wong
01/03/2020, 2:58 PMiosX64("ios") {
compilations {
"main" {
dependencies {
implementation("suparnatural-kotlin-multiplatform:fs-iosx64:$suparnaturalVersion")
}
}
}
}
iosArm64 {
compilations {
"main" {
dependencies {
implementation("suparnatural-kotlin-multiplatform:fs-iosarm64:$suparnaturalVersion")
}
}
}
compilations["main"].defaultSourceSet {
dependsOn(sourceSets["iosMain"])
}
}
Cristián Arenas
01/03/2020, 3:01 PMKurt Renzo Acosta
01/05/2020, 11:09 PM