Open tttzof351 opened 6 years ago
Same problem here. Android packages are not available in the android specific part. But in the ios specific part I can use e.g. the Foundation import.
Could you please update this example? You are making a big investment into KMP, but the introductory example is almost 1 year old and it doesn't show how to reference android code.
For those who end up here looking for a solution, this tutorial helped me
Here are the relevant parts of my build.gradle.kts
plugins {
id("com.android.library")
kotlin("multiplatform")
}
android {
compileSdkVersion(Versions.Android.compileSdk)
defaultConfig {
minSdkVersion(Versions.Android.minSdk)
targetSdkVersion(Versions.Android.targetSdk)
}
sourceSets {
getByName("main") {
manifest.srcFile("src/androidMain/AndroidManifest.xml")
java.srcDirs("src/androidMain/kotlin")
}
}
}
group = "com.kolibree"
version = "1.0-SNAPSHOT"
kotlin {
android()
[...]
When I just write as
actual fun platformName(): String { return "Android " + android.os.Build.VERSION.BASE_OS }
in SharedCode/src/androidMain/kotlin/actual.kt I get: Unresolved reference: android so it's mean that android platform module don't support android sdk :(