I have only a windows laptop,
I have published a kmm library that target Android and Ios from this laptop to Jfrog. I have noticed that only artifacts for common and Android are published, and that seems logic since I don’t have a mac.
Now I need to consume this library from another kmm project that target Android and Ios also, from my same laptop. Currently, I don’t need Ios artifacts because I’m not going to test my app in an ios device, but I don’t want to delete ios targets from build.gradle.kts of my project.
When I consume the published library in commonMain and compile my project, I get this error :
onfiguration cache state could not be cached: field cacheBuilderSettings$delegate
of task :host-module:linkDebugFrameworkIosArm64
of type org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
: error writing value of type ‘kotlin.SynchronizedLazyImpl’
Could not resolve all artifacts for configuration ‘:host-module:iosArm64CompileKlibraries’.
Could not findMyLib
-iosarm64:24.1.0-0010.
Required by:
project :host-module >MyLib
:24.1.0-0010
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Any solution for that ?
I try to publish a KMM library to Maven Central that target Android and Ios from a windows laptop and then consume this library in a KMM project from the same laptop.
I expect that I can build my KMM project normally because I’m using android device to run in, but I got a problem while compiling.
0
I don’t think you can do that. You cannot publish a multiplatform library that targets iOS and Android from a Windows box. You can only publish that from a Mac. So you’ve confused the project that is consuming that library because it expects to find both Android and iOS dependencies in that library.
Since you’ve included this library as a dependency of commonMain
, Gradle expects to find all of the targeted binaries in that library (namely Android and iOS).
If the library only contains support for Android, you’ll need to move the dependency from commonMain
to androidMain
.