Open sureshmaidaragi1919 opened 4 months ago
Could you please provide a project in which you have this exception?
while generating iOS framework using gradle assemble I am seeing the below
How do you run it? Via the Gradle panel, running some task? Which task is it?
Could you please provide a project in which you have this exception?
while generating iOS framework using gradle assemble I am seeing the below
How do you run it? Via the Gradle panel, running some task? Which task is it?
Code base is in private repo basically we have Android related functionalities in AndroidMain of KMM project which uses the XML layouts and Constraints layout's.
By using Android Studio IDE run button or Using Assemble as shown in the blow screen shot
shared build.gradle.kts looks like this
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.ktorfitPlugin)
id("org.jetbrains.compose")
id("dev.icerock.mobile.multiplatform-resources")
id("kotlin-parcelize")
id("com.google.dagger.hilt.android") version "2.44" apply false
id("com.google.devtools.ksp") version "1.9.22-1.0.16"
kotlin("kapt")
}
kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "19"
}
}
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "pitaraShared"
isStatic = false
export("dev.icerock.moko:resources:0.24.0-alpha-5")
export("dev.icerock.moko:graphics:0.9.0") // toUIColor here
}
}
sourceSets {
val androidxActivityVersion = extra["androidx.activity.version"] as String
val androidxAppCompatVersion = extra["androidx.appcompat.version"] as String
val androidxCoreVersion = extra["androidx.core.version"] as String
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
api(compose.animation)
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(libs.koin.core)
implementation(libs.koin.compose)
api(libs.moko.mvvm.core)
api(libs.moko.mvvm.compose)
api(libs.moko.mvvm.flow)
api(libs.moko.mvvm.flow.compose)
implementation(libs.napier)
api(libs.precompose)
api(compose.material3)
api(libs.precompose.permissions)
implementation(libs.datastore.preferences.core) // for key value storage
implementation(libs.date.time)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlin.serialization)
api(libs.image.loader)
api(libs.image.loader.extension.moko.resources)
api(libs.moko.resource)
api(libs.moko.resource.compose)
api(libs.moko.media.compose)
implementation(libs.cashapp.paging.compose.common)
implementation(libs.cashapp.paging.common)
implementation(libs.richEditor)
implementation(libs.skiko)
implementation(libs.ktorfit)
implementation(libs.kotlin.serialization)
implementation(project(":kmm-pw-ui-module"))
implementation(project(":kmm-pw-core-module"))
implementation(project(":kmm-pw-player-module"))
}
}
val androidMain by getting {
dependsOn(commonMain)
dependencies {
api(compose.preview)
api(compose.uiTooling)
api("androidx.activity:activity-compose:$androidxActivityVersion")
api("androidx.appcompat:appcompat:$androidxAppCompatVersion")
api("androidx.core:core-ktx:$androidxCoreVersion")
implementation(libs.app.update)
implementation(libs.koin.android)
// media3 video player
implementation(libs.media3.exoplayer)
implementation(libs.media3.ui)
//android player
implementation ("com.google.android.exoplayer:exoplayer:2.18.7")
implementation ("com.google.android.exoplayer:exoplayer-ui:2.18.7")
implementation ("androidx.constraintlayout:constraintlayout:2.1.4")
implementation ("com.google.code.gson:gson:2.9.0")
implementation ("com.github.ExCiteS:apache-commons-codec-shaded:1.11")
implementation ("io.reactivex:rxandroid:1.2.1")
implementation ("com.squareup.retrofit2:adapter-rxjava:2.7.1")
implementation ("androidx.lifecycle:lifecycle-extensions:2.2.0")
implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1")
implementation ("com.github.instacart:truetime-android:4.0.0.alpha")
implementation ("com.google.dagger:hilt-android:2.48")
implementation ("androidx.constraintlayout:constraintlayout-compose:1.0.1")
kapt {
("com.google.dagger:hilt-android-compiler:2.48")
}
implementation("com.squareup.retrofit2:retrofit:2.9.0") {
}
implementation("com.squareup.retrofit2:converter-gson:2.9.0") {
}
implementation(libs.lifecycle.runtime)
implementation(libs.lifecycle.process)
api(libs.lottie)
implementation(libs.firebase.analytics)
implementation(libs.gitlive.firebase.commons)
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
dependencies {
implementation(libs.kotlinx.coroutines.core)
}
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
}
}
android {
namespace = "com.kmmpwpitara"
compileSdk = 34
defaultConfig {
minSdk = 24
}
kotlin {
jvmToolchain(19)
}
}
dependencies {
with("de.jensklingenberg.ktorfit:ktorfit-ksp:1.12.0") {
add("kspCommonMainMetadata", this)
add("kspAndroid", this)
add("kspAndroidTest", this)
add("kspIosX64", this)
add("kspIosX64Test", this)
add("kspIosArm64", this)
add("kspIosArm64Test", this)
add("kspIosSimulatorArm64", this)
add("kspIosSimulatorArm64Test", this)
}
}
project.afterEvaluate {
tasks.named("kspKotlinIosSimulatorArm64") {
dependsOn("generateMRiosSimulatorArm64Main")
}
tasks.named("kspKotlinIosX64") {
dependsOn("generateMRiosX64Main")
}
tasks.named("kspKotlinIosArm64") {
dependsOn("generateMRiosArm64Main")
}
}
Code base is in private repo basically
Can you make a minimal project with the issue? I tried the provided build.gradle.kts
, but it depends on many other things.
The error is vague and it is difficult to fix if it isn't reproducible. It might be a non-Compose plugin, or a conflict of Compose plugin with some other plugin.
Did you find any workaround? Facing the same issue
Did you find any workaround? Facing the same issue
Can you provide the project or a minimal version with the issue on which we can look?
For my project, the buildconfig library is causing the issue.
https://github.com/gmazzo/gradle-buildconfig-plugin/issues/149
After some research, I realized the issue is that for some reason, the composeApp.klib
content is not generated with lowercase (expected), that's the reason why is failing:
Correct | Failure |
---|---|
I've pushed the code here: https://github.com/gmazzo/kmp-compose-issue-4444
If you comment the line at https://github.com/gmazzo/kmp-compose-issue-4444/blob/main/composeApp/build.gradle.kts#L11 then the .klib
gets generated with the right casing, but how this plugin is indirectly? triggering the issue, is something I couldn't figure out 🤷♂️
To reproduce the issue, run:
./gradlew linkDebugFrameworkIosSimulatorArm64
but how this plugin is indirectly? triggering the issue, is something I couldn't figure out 🤷♂️
Update: if this issue is only happening when combined with https://github.com/gmazzo/gradle-buildconfig-plugin, the root cause is a package clash:
The buildconfig plugin defaults to the project's name (without any mangling) while compose-multiplatform
does it to a lowercase of it:
A quick workaround will be set it packageName
explicitly, for instance:
buildConfig {
packageName = "kotlinproject.composeapp"
}
Describe the bug A clear and concise description of what the bug is.
Affected platforms
Versions
To Reproduce
Expected behavior I am using the above version of Kotlin and Jetbrain compose android build works fine but while generating iOS framework using gradle assemble I am seeing the below
Screenshots
Additional context