Vita Sokolova
02/09/2024, 1:12 PMdebug
and release
aar I build from my KMP code. At the moment, I use my KMP project to share data layer between Android and iOS projects, which consume it as an external library.
From KMP side I build two library variants for Android:
androidTarget {
publishLibraryVariants("release", "debug")
}
But on Android I have to specify which version to use:
debugImplementation("com.xxx.yyy:shared-android-debug:0.1")
releaseImplementation("com.xxx.yyy:shared-android:0.1")
I wonder if I benefit from building different variants or should I just build a`release` only.
Can someone share real use cases when such separation can be useful?ephemient
02/09/2024, 1:41 PMimplementation("com.xxx.yyy:shared-android:0.1")
Vita Sokolova
02/09/2024, 1:54 PMallshared
- contains all modules
• analytycs
• common-entities
• …
I have a dependency from allshared
in my android app
module (I have a DI graph initialization in allshared) and I have dependencies from analytics
, where it is required in my feature modules.
As a result, if I don’t declare debugImplementation/releaseImplementation separately I receive error like this:
Duplicate class com.xxx.yyy.analytics.Analytics found in modules analytics-debug-runtime (com.xxx.yyy:analytics-android-debug:0.1) and analytics-release-runtime (com.xxx.yyy:analytics-android:0.1)
Vita Sokolova
02/09/2024, 1:56 PM./gradlew app:dependencies
and it looks like on KMP side my modules depend on -debug artefacts, but my android app uses release versions and they are in conflict.louiscad
02/12/2024, 12:02 PM-android
suffix altogether should resolve to the right one:
implementation("com.xxx.yyy:shared:0.1")
On top of that, you can publish only the release variant if there's no debug specific code you need to be present only in debug mode.Vita Sokolova
02/12/2024, 12:03 PMjar
instead of aar
, right?louiscad
02/12/2024, 12:04 PMlouiscad
02/12/2024, 12:04 PMlouiscad
02/12/2024, 12:06 PMVita Sokolova
02/12/2024, 12:25 PMlouiscad
02/12/2024, 12:32 PM