Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building in multiplatform Kotlin 1.4 fails on iOS Apple M1 #2186

Closed
billmartensson opened this issue Mar 2, 2021 · 4 comments
Closed

Building in multiplatform Kotlin 1.4 fails on iOS Apple M1 #2186

billmartensson opened this issue Mar 2, 2021 · 4 comments
Labels

Comments

@billmartensson
Copy link

billmartensson commented Mar 2, 2021

System: Mac Mini M1
Android Studio 4.1.2 Using latest version KMM plugin.

Running in Xcode gives this error:
w: Skipping "/Users/myuser/.gradle/caches/modules-2/files-2.1/com.squareup.sqldelight/coroutines-extensions-iosarm64/1.2.1/6f9cb702773650c989d7becade6206840579ac64/coroutines-extensions.klib" as it is a pre 1.4 library
e: Could not find "/Users/myuser/.gradle/caches/modules-2/files-2.1/com.squareup.sqldelight/coroutines-extensions-iosarm64/1.2.1/6f9cb702773650c989d7becade6206840579ac64/coroutines-extensions.klib" in [/Users/myuser/project/android/theproject, /Users/myuser/.konan/klib, /Users/myuser/.konan/kotlin-native-prebuilt-macos-1.4.21/klib/common, /Users/myuser/.konan/kotlin-native-prebuilt-macos-1.4.21/klib/platform/ios_arm64].

Android app runs just fine.

Project build.gradle.kts:
dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") classpath("com.android.tools.build:gradle:4.1.2") classpath("com.squareup.sqldelight:gradle-plugin:1.4.3") classpath("org.jetbrains.kotlin:kotlin-serialization:1.4.21") }

Module build.gradle.kts:
`
val commonMain by getting {
dependencies {
implementation("com.squareup.sqldelight:sqlite-driver:1.2.1")

implementation("com.squareup.sqldelight:runtime:1.4.3")
implementation("com.squareup.sqldelight:coroutines-extensions:1.2.1")

}
}

val androidMain by getting {
dependencies {
implementation("com.squareup.sqldelight:android-driver:1.2.1")
implementation("com.squareup.sqldelight:coroutines-extensions-jvm:1.2.1")

}
}

val iosMain by getting {
dependsOn(sourceSets["commonMain"])
dependencies {

implementation("com.squareup.sqldelight:ios-driver:1.2.1")

}
}
`

@kpgalligan
Copy link
Collaborator

Forgetting the M1 for a bit, your sqldelight versions aren't aligned. You're mixing 1.4.3 and 1.2.1, and the error as it is a pre 1.4 library relates to that.

I don't know if Kotlin/Native is yet compatible with the M1, but you'll want to run everything on current versions.

@billmartensson
Copy link
Author

The ios-driver latest version is 1.2.1 så leave everything on that? Even if other parts have a higher version?

@kpgalligan
Copy link
Collaborator

ios-driver is the old module name. It's native-driver. For example:

https://github.com/touchlab/KaMPKit/blob/master/buildSrc/src/main/java/Dependencies.kt#L97

Current version is 1.4.4.

@billmartensson
Copy link
Author

Lifted everything to 1.4.4
Changed iosMain to:
implementation("com.squareup.sqldelight:native-driver:1.4.4")

Now get this both testing with simulator and device:
`Execution failed for task ':shared:compileKotlinIosArm64'.

Could not resolve all files for configuration ':shared:iosArm64CompileKlibraries'.
Could not resolve com.squareup.sqldelight:sqlite-driver:1.4.4.
Required by:
project :shared
> No matching variant of com.squareup.sqldelight:sqlite-driver:1.4.4 was found. The consumer was configured to find a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' but:
- Variant 'apiElements' capability com.squareup.sqldelight:sqlite-driver:1.4.4 declares an API of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_arm64')
- Variant 'runtimeElements' capability com.squareup.sqldelight:sqlite-driver:1.4.4 declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_arm64')

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants