Katyrin Roman
01/25/2024, 6:41 AM- shared
-- resources
-- feature-1
-- feature-2
The only working solution that made my project build on both Android and iOS was to register the moko resources plugin for the iOS version, and remove this solution for Android. Also, when building the IOS, it is necessary to replace implementation(project(:resource)) with api(project(:resource))
My shared module:
plugins {
. . .
id("dev.icerock.mobile.multiplatform-resources") <- only for ios
}
kotlin {
androidTarget()
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = ProjectSettings.IOS_DEPLOYMENT_TARGET
version = ProjectSettings.VERSION_NAME
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "shared"
isStatic = true
export(project(":resource"))
transitiveExport = true
}
}
sourceSets {
val commonMain by getting {
dependencies {
api(project(:resource)) <- api for ios, implementation for android
}
}
. . .
}
. . .
}
Is there a more automated way to build two versions without making changes to Gradle?
Thanks in advance for any answer or advice on what I'm doing wrong)
Kotlin: 1.9.10
Gradle plugin: 8.1.2
Moko-resources: 0.23.0alex009
01/25/2024, 4:15 PMKatyrin Roman
01/26/2024, 5:50 PMBekzod
02/16/2024, 12:29 PMKatyrin Roman
02/16/2024, 1:16 PMBekzod
02/19/2024, 8:54 AM