Smoothie
04/22/2026, 3:43 PMoptimization {
minify = true
keepRules.apply {
file(getDefaultProguardFile("proguard-android-optimize.txt", layout.buildDirectory))
file("<http://proguard-rules.pro|proguard-rules.pro>")
}
}
I get an error
Could not determine the dependencies of task ':lib:minifyAndroidMainWithR8'.
> Cannot query the value of this property because it has no value available.
I'm using the com.android.kotlin.multiplatform.library:9.1.1Valeriy O.
04/22/2026, 5:40 PMAnton Makeev
04/23/2026, 6:56 AMkotlin {
android {
optimization {
minify = true
consumerKeepRules.apply {
publish = true // needed since AGP 9
file("<http://proguard-rules.pro|proguard-rules.pro>")
}
}
}
}
Related doc: https://developer.android.com/kotlin/multiplatform/plugin#consumer-keep-rulesMarcin Kiżewski
04/23/2026, 7:49 AMandroid-kotlin-multiplatform-library plugin and the 'official' way would be to extract it to android-only library module (via android-library plugin) and add it as a dependency to multiplatform module, which would be tedious for bigger libs.
What I've actually done to overcome this issue is I've written gradle plugin which decompress built AAR, then uses R8 to obfuscate/minimise files and finally repackage library, back to AAR.
Please @Anton Makeev, if You're reading this, why is it not possible to obfuscate/minimise multiplatform library easier? There can actually be cases where it is needed.Smoothie
04/23/2026, 9:48 AMSmoothie
04/23/2026, 9:50 AMGeorge McDonnell
04/23/2026, 1:59 PMoptimization {
minify = true
keepRules.apply {
file("proguard-rules.pro")
}
consumerKeepRules.apply {
file("proguard-rules.pro")
publish = true
}
}Marcin Kiżewski
04/23/2026, 2:31 PMMarcin Kiżewski
04/23/2026, 2:31 PMSmoothie
04/23/2026, 8:43 PMGeorge McDonnell
04/24/2026, 8:13 AM