I try to sync and build a project in KMP but I have this error:
The Default Kotlin Hierarchy Template was not applied to ‘project ‘:core”:
Explicit .dependsOn() edges were configured for the following source sets:
[iosArm64Main, iosArm64Test, iosMain, iosSimulatorArm64Main, iosSimulatorArm64Test, iosTest, iosX64Main, iosX64Test]
Consider removing dependsOn-calls or disabling the default template by adding
‘kotlin.mpp.applyDefaultHierarchyTemplate=false’
to your gradle.properties
I have a Mac whit M2 chip, this is build.gradle.kts file:
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
id("kotlinx-serialization")
}
kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "11"
}
}
}
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "14.1"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "core"
isStatic = true
}
pod("UICKeyChainStore")
pod("FirebaseCore")
pod("FirebaseInstanceID")
}
val coroutines = "1.8.0"
val ktor = "2.3.9"
sourceSets {
all {
languageSettings.optIn("kotlin.RequiresOptIn")
languageSettings.optIn("kotlin.experimental.ExperimentalObjCName")
}
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines")
// Http
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor")
implementation("io.ktor:ktor-client-core:$ktor")
implementation("io.ktor:ktor-client-serialization:$ktor")
implementation("io.ktor:ktor-client-logging:$ktor")
implementation("io.ktor:ktor-client-content-negotiation:$ktor")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting {
dependencies {
api("io.ktor:ktor-client-okhttp:$ktor")
implementation("io.ktor:ktor-client-serialization-jvm:$ktor")
implementation("io.ktor:ktor-client-logging-jvm:$ktor")
implementation("com.facebook.stetho:stetho-okhttp3:1.6.0")
implementation("com.google.firebase:firebase-core:21.1.1")
implementation("com.google.firebase:firebase-messaging:23.4.1")
}
}
val androidUnitTest by getting
val androidInstrumentedTest by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
dependencies {
// Http
//implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:1.0-M1-1.4.0-rc")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
implementation("io.ktor:ktor-client-ios:$ktor")
//implementation("io.ktor:ktor-client-serialization-native:1.3.2")
//implementation("io.ktor:ktor-client-logging-native:1.3.2")
}
}
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
}
}
android {
namespace = "com.****.****.core"
compileSdk = 34
defaultConfig {
minSdk = 23
testOptions.targetSdk = 34
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(11))
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs> {
kotlinOptions {
jvmTarget = "11"
}
}
}
any idea to fix this?