Reputation: 1478
Is there some workaround to skip the 64k method limitation while testing my Android app in the emulator?
Upvotes: 0
Views: 235
Reputation: 3688
You could use proguard and try to shrink your code. This would be the preferred option.
Otherwise, make it multidex (but I don't see how it'll be "just for testing" unless you still shrink your code before deploying it).
You can achieve that by one of the three easy ways:
MultidexApplication
(rather than simply Application
).android:name="android.support.multidex.MultidexApplication"
attribute to your application tag in AndroidManifest.xml
If you have an application class but can't override MutlidexApplication
(because you're not overriding Application
to begin with but some other custom application class), add the following override:
@Override
protected void attachBaseContext(Context context) {
super(context);
Multidex.install(this);
}
[if you are supporting API levels lower than 21, you'll need to add the android-support-multidex.jar
dependency to your project. It can be found under the extras
folder in the android-sdk directory]
Upvotes: 3
Reputation: 148
The Limit is 64 x 1024 = 65.536 Methods. That means 64K Methods. You can't change this maximum, but you can shrink the libraris. All you need to do is to shorten the librarys like this:
Bad:
compile 'com.google:9.6.1'
better:
compile 'com.google.android.gms:play-services:9.6.1'
Upvotes: 0
Reputation: 1181
there is no workaround beyond proguard stripping off enough to get you below the limit if you're lucky. just implement multidex. it's very easy now.
Upvotes: 1