Mark
05/13/2025, 5:57 AMBuildConfig.DEBUG
). I’ve tried BuildKonfig
but that doesn’t provide a good solution for this either. Now I’m looking at creating an Android-only shared module (for this as well other things like resource ids not handled by KMP) and adding that as a dependency to androidMain of the KMP library. I would need to add solutions for other platforms, but am happy to defer that until later. Is that Android dependency-based strategy good or is there a better solution?zsmb
05/13/2025, 6:02 AMBuildConfig.DEBUG
in androidMain
.Mark
05/13/2025, 6:09 AMBuildConfig
. This is why I proposed the Android module dependency. Do you know of a way for KMP androidMain
to be configured to build BuildConfig
?zsmb
05/13/2025, 6:32 AMBuildConfig
generated there.
I created this quick example, seems to work fine (implemented on Android, stubbed on iOS): https://github.com/zsmb13/BuildConfigExample250513/commit/6db2088c732bfe58ff5ffa83cda768def0d0da05Mark
05/13/2025, 6:48 AMNew Module / Kotlin Multiplatform Shared Module
, which adds the plugin: com.android.kotlin.multiplatform.library
and this cannot be used with com.android.library
in the same module. I guess this is why you are able to generate the BuildConfig
. For the KMP android library plugin it allows configuration via kotlin { androidLibrary { … } }
and it’s not clear to me how to convert that to the old Android way, or indeed whether I should go that route.zsmb
05/13/2025, 7:08 AMMark
05/13/2025, 7:13 AMcom.android.library
plugin to com.android.kotlin.multiplatform.library
?
EDIT: https://developer.android.com/kotlin/multiplatform/pluginMark
05/14/2025, 4:43 AMAndroidManifest
(because I need to use addManifestPlaceholders
which is unavailable in androidLibrary
dsl). And for the BuildConfig
as mentioned above. This is of course only a temporary solution as I continue to migrate the app to KMP. The one thing that isn’t working are unit tests that call code that reference resources. The tests (which are in androidHostTest
) fail with: java.lang.NoClassDefFoundError: foo/bar/R$string
zsmb
05/14/2025, 12:37 PMzsmb
05/14/2025, 12:38 PMMark
05/14/2025, 2:18 PMzsmb
05/14/2025, 2:19 PM