r/reactnative • u/Miserable-Pause7650 • 1d ago
Why is dex code optimization at 0% in android
/r/expo/comments/1y3loza/why_is_dex_code_optimization_at_0_in_android/
2
Upvotes
r/reactnative • u/Miserable-Pause7650 • 1d ago
2
u/Western_Cap_6934 1d ago
A possible cause is -dontoptimize in the generated release R8 configuration. It disables code optimization while shrinking and obfuscation can still run.
1
u/atta542 1d ago
if it's a prebuild/bare project check android/app/build.gradle. the RN template uses getDefaultProguardFile("proguard-android.txt") and that default file has -dontoptimize in it, so R8 shrinks and obfuscates but skips optimization, which would line up with what you're seeing. switching it to proguard-android-optimize.txt is usually what turns it on, and the -printconfiguration tip above will confirm it either way. just test the release build properly after, optimization can break stuff that relies on reflection