Closed elviss116 closed 1 month ago
Hey @elviss116,
Thanks for raising this! Could you please double-check whether the issues disappear after removing the swiftklib plugin? The errors you provided don't seem relevant to the plugin.
I'm seeing the same issue in a project generated by the Kotlin Multiplatform Wizard. This is a project with "Shared UI" via Compose Multiplatform and Kotlin 2.0.
e: file:///Users/phatblat/dev/kmp/KMPWizard-swiftklib/composeApp/build.gradle.kts:14:5: Unresolved reference: androidTarget
Example repo: https://github.com/phatblat/KMPWizard-swiftklib
I get the same errors in a project without the "Shared UI" and downgrading the template from Kotlin 2.0 to 1.9.23. See KMPWizard-swiftui
I had same issue and I was able to fix it by using alias() in my build.gradle
Old gradle
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.ksp)
id("io.github.ttypic.swiftklib") version "0.5.1"
}
toml version file:
[versions]
klib = "0.5.1"
[plugins]
klib = { id = "io.github.ttypic.swiftklib", version.ref = "klib" }
application gradle
plugins {
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.ksp) apply false
alias(libs.plugins.klib) apply false
}
New gradle:
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.ksp)
alias(libs.plugins.klib)
}
Hope this helps
@mohamad-abuzaid @phatblat Please test the 0.6.2 release of the plugin. This issue should be fixed now.
Closing this issue for now. Feel free to reopen if issue persists
Hi, I can't sync my project after add your plugin:
`
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
}
kotlin { androidTarget { compilations.all { kotlinOptions { jvmTarget = "11" } } }
}
android { namespace = "org.kmp.klib.plugin" compileSdk = libs.versions.android.compileSdk.get().toInt()
}
`
error:
`
What went wrong: Script compilation errors:
Line 13: androidTarget { ^ Unresolved reference: androidTarget
Line 14: compilations.all { ^ Unresolved reference: compilations
Line 15: kotlinOptions { ^ Unresolved reference: kotlinOptions
Line 16: jvmTarget = "11" ^ Unresolved reference: jvmTarget
Line 34: androidMain.dependencies { ^ Unresolved reference: androidMain`