r/reactnative • • 10d 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

9 comments sorted by

View all comments

2

u/Western_Cap_6934 10d 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/Miserable-Pause7650 10d ago

I checked that already and I dont think I have it in the generated prebuild. Will check again when I get home thanks!

2

u/Western_Cap_6934 9d ago

Prebuild files are only part of the picture. R8 can merge rules from other sources. Adding -printconfiguration build/outputs/logs/configuration.txt to the rules file used by the release build writes the final merged rules, so you can check what R8 actually received.

1

u/Miserable-Pause7650 9d ago

2

u/Western_Cap_6934 9d ago

That would explain why prebuild looked clean: the Amazon module can bring the flag in through consumer rules, even for non-Amazon apps.