Sunday, March 1, 2015

Android and the DEX 64K Methods Limit & Online Tool

Our apps are limited to a 64K method reference limit. If your app reaches this limit, the build process outputs the following error message:

Unable to execute dex: method ID not in [0, 0xffff]: 65536


This is a drap and drop tool which helps us to find the number of method in apk
Which helps us to be in safe-guard in optimizing things. Know we need some solutions to optimize the problem. Let find them



MultiDex allows you to use multiple DEX files contained within one APK. With a few steps, your classes will split automatically into several DEX files (classes.dex,classes2.dex, classes3.dex, etc) in case you reach the method index limit.
ProGuard is a tool that shrinks, optimizes and obfuscates your code by removing unused code and renaming classes, fields and methods with semantically obscure names.


Jar Jar Links is a utility that makes it easy to repackage Java libraries and embed them into your own distribution.


At this point, Google Play Services is perhaps the biggest common threat on your methods count. I would love to see this API broken into separate modules. A detailed summary of this problem was published a while ago by Jake Wharton & Android and the dex 64k methods limit by Tom Renzik, so feel free to dive into that as well.

Another interesting blog post was published a while ago by Cyril Mottier, illustrating how to reduce APK size using various different techniques. 

Thanks for reading :) 
Whether this post is helpful?

Have something to add to this post? If you have any other quick thoughts/hints that you think people will find useful? Share it in the comments.