To ∞ (~65K) and beyond!
summary
Android hits a hard limit because the method reference index is 16 bits, so only 65,536 references fit; when exceeded builds fail with Too many method references (max 65536). Practical fixes: enable multiDex in Gradle (support lib works but adds startup cost and Dalvik instability pre‑Lollipop), or manually create secondary .dex files with a custom classloader (interfaces preferred over reflection). Best first step is shrinking with ProGuard (be specific with keep rules — a bad rule can waste ~6,000 methods). Use ClassyShark and dexcount to find culprits.
AI-written summary · about
chapters (10)
- 0:00Start
- 4:53Crossing the limit
- 7:02Approaches
- 10:13Setup 3/3
- 12:18Disadvantages
- 14:54Secondary DEX
- 15:49How does it work
- 17:50Quick example w Reflection
- 21:46Improvements
- 32:29ClassyShark
related talks
29m10 Ways To Improve Your Android App Performance
28mEscaping from a 'It Kinda Works' ProGuard Setup
45mHigh performance in Android
28mBest practices using compilers in Android Studio
55mCompilers. Dalvik. ART. And everything in between
35mWhat's in the Android Toolbox?
51mExploring Java’s Hidden Costs
35mUnderstanding the Kotlin to Dalvik bytecode translation
