r/expo • u/Miserable-Pause7650 • 6d ago
Why is dex code optimization at 0% in android

android: {
enableMinifyInReleaseBuilds: true,
enableShrinkResourcesInReleaseBuilds: true,
extraProguardRules: `
-keep class androidx.work.impl.WorkDatabase_Impl {
<init>();
}
`,
},I have already done this. My obfuscation percentage and shrinking percentage are both decent, but why aint my optimization optimizing?
5
Upvotes
2
u/OrneryArtist1087 4d ago edited 4d ago
Following https://www.reddit.com/r/expo/s/MEKe4Bugu5 fixed my issue.
In my case, simply upgrading RevenueCat was enough.
1
u/Miserable-Pause7650 4d ago
Thanks guys. Made it work by upgrading my revenue cat package to v10, I was using an outdated one
2
u/zzoa7922 5d ago
Not Expo in my case (a plain Gradle Android app), but I hit something similar. Play reads what R8 wrote into the bundle (r8.json), not your build flags, and right after the upload my optimization ratio just showed "-" for a while even though R8 full mode was on. So I'd open the .aab, check r8.json, and make sure a mapping.txt was generated for that build before touching the proguard rules.
2
u/Russel-D-Souza 4d ago
Your minify is clearly on (77% obfuscation), so it's probably a -dontoptimize in the R8 config. The RN template uses proguard-android.txt, which turns optimization off. Swap it for proguard-android-optimize.txt in app/build.gradle (config plugin if you're on prebuild) and it should go up. Just test the release build after, reflection-heavy libs can break!