J-Rojas
03/20/2018, 10:27 PMactual/expect classes in a multiplatform project using K/N for iPhone target. I'm running the gradle build task compileKonan and the compiler generates an error when compiling one my actual class definitions.
UUID.kt:3:14: error: actual class 'UUID' has no corresponding expected declaration
actual class UUID {
My gradle.build file for the native project
apply plugin: 'konan'
konan.targets = ["iphone", "iphone_sim"]
konanArtifacts {
library('native') {
enableMultiplatform true
commonSourceSet 'main'
srcDir 'src/main/kotlin'
}
}
dependencies {
expectedBy project(':common')
}
task test(dependsOn: run)
Any thoughts on how I might have misconfigured my gradle build? I'm using v0.6 kotlin-native plugin for MacOS. My actual/expect declarations work in my common and android modules in the multiplatform project, not in the native build currently.
My class is defined in the common module as such:
package some.package.name
expect class UUID {
companion object {
fun randomUUID() : UUID
}
}Sam
03/20/2018, 10:37 PMkonanArtifacts {
framework('native') {
enableMultiplatform true
}
}
The source set default is main so you shouldn't need that. Also the srcDir is redundant since that should be the default. You should use framework for iOS since that will build a dynamic library.J-Rojas
03/20/2018, 10:39 PMframework but these changes don't address my compiler error.Sam
03/20/2018, 10:43 PMbuildScript block with a dependency on the kotlin-native-gradle-plugin?
buildscript {
repositories {
mavenCentral()
maven {
url "<https://dl.bintray.com/jetbrains/kotlin-native-dependencies>"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$kotlin_native_version"
}
}J-Rojas
03/20/2018, 10:47 PMexpect declaration in the common module.Sam
03/20/2018, 11:31 PMJ-Rojas
03/21/2018, 2:38 AMJ-Rojas
03/21/2018, 2:41 AMrusshwolf
03/21/2018, 2:55 AMSam
03/21/2018, 4:28 PMJ-Rojas
03/21/2018, 5:20 PMTobi
03/22/2018, 3:40 PMJ-Rojas
03/23/2018, 2:07 PMactual declarations. Command line builds work fine. Are you guys using Jetbrains IDEs for compilation of multiplatform projects?Tobi
03/23/2018, 4:13 PMSam
03/25/2018, 3:41 PM:native:buildJ-Rojas
03/27/2018, 8:40 AMcom.android.tools.build:gradle:3.+. I've tried :native:build and that doesn't work either for me. What version of AS are you using? I'm using v3.0.1.