Closed AndreProc closed 2 years ago
Replace your
cocoapods {
...
frameworkName = "shared"
}
by
cocoapods {
...
framework {
baseName = "shared"
isStatic = false
}
}
the isStatic should fix the preview issue.
Hi, thank you velco-greg now it works!!
Got this error on multiplatform project with cocoapods integration on M1 mac for SwiftUI previews:
Undefined symbols for architecture arm64:
"_sqlite3_bind_text16", referenced from:
…
Adding framework
block to build.gradle (groovy, not kts) to disable static libraries linking causes new error:
GradleScriptException: A problem occurred evaluating project ':app'
Caused by: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method org.jetbrains.kotlin.gradle.plugin.cocoapods.CocoapodsExtension#framework.
Cannot resolve which method to invoke for [class build_42g33lhz9jylwm28rb1jce30$_run_closure2$_closure8$_closure13] due to overlapping prototypes between:
[interface kotlin.jvm.functions.Function1]
[interface org.gradle.api.Action]
…
because both methods has same labmda-like signatures in JVM for groovy in CocoapodsExtension.kt:
fun framework(configure: Framework.() -> Unit)
fun framework(configure: Action<Framework>)
So only explicit type with parenthes is working for me:
cocoapods {
…
framework((Action) {
it.isStatic = false // SwiftUI preview requires dynamic framework
})
}
I've spent hours on this issue with previews, I hope it helps.
SQLDelight Version
1.5.0
Operating System
macOS Big Sur 11.2.3
Gradle Version
7.0.0-rc01
Kotlin Version
1.5.10
AGP Version
No response
Describe the Bug
Hi, I have a problem previewing SwiftUI views in Xcode, the problem seems to be caused by the dependency “implementation("com.squareup.sqldelight:native-driver:${Versions.Shared.sqlDelight}”)”. Without that dependency the preview works. To reproduce the error create a new kmm project using AndroidStudio and then paste the sourceSets in the build.gradle of the shared project. Now open the iOS project and try to build the ContentView preview. Thanks in advance! AP
Stacktrace
Gradle Build Script
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins { kotlin("multiplatform") kotlin("native.cocoapods") id("com.android.library") }
version = "1.0"
object Versions { const val kotlin = "1.5.10" const val gradlePlugin = "7.0.0-rc01"
}
kotlin { android()
}
android { compileSdkVersion(30) sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") defaultConfig { minSdkVersion(21) targetSdkVersion(30) } }