Vita Sokolova
01/31/2024, 5:11 PMplugins {
kotlin("multiplatform")
id("com.android.library")
`maven-publish`
}
kotlin {
androidTarget {
publishAllLibraryVariants()
}
iosX64()
iosArm64()
iosSimulatorArm64()
applyDefaultHierarchyTemplate()
sourceSets {
val commonMain by getting {
dependencies {
api(project(":domain")) <--- HERE
}
}
}
}
android {
compileSdk = libs.versions.compileSdk.get().toInt()
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
}
namespace = "com.temper.works.analytics"
}
addGithubPackagesRepository()
To debug my changes from Android app I try to build as less artefacts as possible, I thought running publishAndroidReleasePublicationToMavenLocal
and publishAndroidReleasePublicationToMavenLocal
would be enough. When I try to build only android artefacts and resolve them from maven local in my Android app, gradle complains that it needs a domain (not domain-android) artefact. I add a dependency in my Android app in a trivial way, nothing special:
api("com.temper.works:analytics-android:0.1")
Build error looks like that:
Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':freeflex:mergeDebugAssets'.
> Could not resolve all files for configuration ':freeflex:debugRuntimeClasspath'.
> Could not find com.temper.works:domain:0.1.
Searched in the following locations:
- <https://dl.google.com/dl/android/maven2/com/temper/works/domain/0.1/domain-0.1.pom>
- file:/Users/sokolova/.m2/repository/com/temper/works/domain/0.1/domain-0.1.pom
...
Required by:
project :freeflex > project :freeflex-core > com.temper.works:analytics-android:0.1
I would expect it to use com.temper.works:domain-android
🤔 Can someone help me to understand why it happens?Chrimaeon
01/31/2024, 6:27 PMdomain
also to your local maven? It’s a transitive dependency and is pulled from a maven repository as well.hfhbd
01/31/2024, 9:30 PMVita Sokolova
02/01/2024, 8:58 AMdomain-android
and I would expect it to be enough, but it is notVita Sokolova
02/01/2024, 9:30 AMapi
Vita Sokolova
02/01/2024, 9:31 AMhfhbd
02/01/2024, 9:33 AMVita Sokolova
02/01/2024, 9:44 AMVita Sokolova
02/01/2024, 9:48 AMapp
module (it is called "freeflex") includes freeflex-core
(utility modules all features depend on):
implementation(project(":freeflex-core"))
and freeflex-core
has dependency on analytics-android KMP library:
api("com.temper.works:analytics-android:0.1")
Vita Sokolova
02/01/2024, 9:48 AMhfhbd
02/01/2024, 9:49 AMI'm not sure you want to see itWell, to help you the failure message is more interesting than a working build 😄
Vita Sokolova
02/01/2024, 9:56 AMhfhbd
02/01/2024, 10:04 AMcom.temper.works:domain:0.1.
locally, see: https://scans.gradle.com/s/mw3hcxzhrf5z2/dependencies?focusedDependency=WzIsMSwzODQyLFsyLDEsWzI5MjEsMzg0Ml1dXQ&focusedDependencyView=details&toggled=W1syXSxbMiwxXSxbMiwxLFsyOTIxXV1dhfhbd
02/01/2024, 10:04 AMdomain-android
only contains the android partVita Sokolova
02/01/2024, 10:25 AMVita Sokolova
02/01/2024, 10:29 AMhfhbd
02/01/2024, 10:33 AMjava-api
variant of your dependency, not the aar
.Vita Sokolova
02/01/2024, 11:40 AM