Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
"64k out to be enough for anyone"
Search
Michael Evans
October 29, 2014
Technology
2k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
"64k out to be enough for anyone"
64k method limit talk @ DC Droids meetup
Michael Evans
October 29, 2014
More Decks by Michael Evans
See All by Michael Evans
#AndroidBuilds at Twitter
michaelevans
0
54
Android U+2764 (❤) Emoji
michaelevans
4
790
Kotlin for Android Developers - DevFest Chicago / DC
michaelevans
1
290
@AnnotationProcessors("ByExample") (Droidcon NYC 2015)
michaelevans
24
22k
Other Decks in Technology
See All in Technology
『止めない』を設計する — 制約の中で、事業の根幹を支える判断
hiroyaterui
0
260
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
150
20260912_スクラムにジェネラリストは必要か
ryugen04
0
320
10分で知る最近のOmarchy
komagata
0
250
KPIだけでは評価できないプロダクトが考えるべき Evalsという第二の評価系 / Beyond KPIs: Evals as a Second Evaluation Framework for Products #PdEConf
aki_iinuma
4
3.9k
AIに丸投げしないトイル削減 / Eliminating Toil Without Leaving It All to AI
kohbis
4
1.1k
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
When Does a Local Qwen Start to Break
morshoto
0
200
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
300
AIで実装は速くなった。なのにプロダクトは速くならない。職能の壁を越えて価値のフローを設計する
nwiizo
8
7.8k
Omarchy Quattro の日本語設定周り
simosako
2
140
Redmine 7.0で私が開発した新機能の狙いと背景
vividtone
1
160
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Faster Mobile Websites
deanohume
310
32k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
690
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
530
Designing Powerful Visuals for Engaging Learning
tmiket
1
540
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
440
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
820
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Color Theory Basics | Prateek | Gurzu
gurzu
0
460
Transcript
Mike Evans LivingSocial @m_evans10
“640K ought to be enough for anybody.”
–Dalvik Developers “64K ought to be enough for anybody.”
Dalvik?
Dalvik?
Dalvik The VM that runs Android. Optimized for mobile devices.
Java/Scala/Clojure/etc Compiler (.jar) .class files JAVA ARCHITECTURE
.class files classes.dex Java/Scala/Clojure/etc Compiler dex (.apk) ANDROID ARCHITECTURE
Java/Scala/Clojure/etc Compiler dex optimizer (odex) zipalign proguard ANDROID ARCHITECTURE classes.dex
(.apk) .class files
Okay…what’s the problem?
Unable to execute dex: method ID not in [0, 0xffff]:
65536 ! Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536 PROBLEM:
https://source.android.com/devices/tech/dalvik/dex-format.html public final class IndexMap { … public final short[]
typeIds; public final short[] protoIds; public final short[] fieldIds; public final short[] methodIds; …
So what can we do?
SOLUTION #0:
ART? SOLUTION #1:
SOLUTION #2: Proguard Java class file shrinker, optimizer and obfuscator
! Detects and removes unused classes, fields, methods and attributes
SOLUTION #3: Refactor code so that code can be isolated
into 2nd dex Modify classpath during runtime Allow access to methods via reflection ! Facebook did this in 2011 Secondary DEX file
SOLUTION #3: Secondary DEX file Refactor code so that code
can be isolated into 2nd dex Modify classpath during runtime Allow access to methods via reflection ! Facebook did this in 2011
MultiDexApplication BRAND NEW
MultiDexApplication Native in Lollipop ! Part of support library (all
the way to Donut!) ! Not supported officially in developer tools…yet BRAND NEW
an egregious hack
a clever solution an egregious hack
None
$ ./dex-method-counts LivingSocial.apk ! Read in 65490 method IDs. <root>:
65490 : 3 android: 6837 accessibilityservice: 6 bluetooth: 2 … https://github.com/mihaip/dex-method-counts
GPS: 14K methods - collections, caching, primitives support, concurrency libraries,
common annotations, string processing, I/O, and so forth. 23k methods - Basically all of Google’s services. You’ll have a hard time making a compelling app that lives in the Google Play ecosystem without it. GUAVA:
$ gradle app:dependencies —configuration “compile” ! compile - Classpath for
compiling the main sources. +--- com.squareup.picasso:picasso:2.3.3 +--- com.jakewharton:butterknife:5.1.2 +--- com.squareup.retrofit:retrofit:1.6.1 | \--- com.google.code.gson:gson:2.2.4 -> 2.3 \--- de.hdodenhof:circleimageview:1.2.0 … ! BUILD SUCCESSFUL GUAVA:
ads analytics cast auth drive games push location maps wallet
wearable … A clever way for Google to provide support for its many services APIs, all the way back to Gingerbread Google Play Services: {
GAMES DRIVE ADS CAST
https://gist.github.com/MichaelEvans/71150c93577de6f5ab0a Custom Gradle Task - After compilation of .class files
Unzip the original google-play-services rm [plus|games|drive|cast] re-zip a new jar Inject new jar into dependency tree ??? Profit
$ ./dex-method-counts LivingSocial.apk ! Read in 40364 method IDs. <root>:
40364 : 3 android: 6837 accessibilityservice: 6 bluetooth: 2 …
Questions?