Dalvik 65536 methods limitation and Facebook workaround

May be you know or may be you don’t know but Dalvik has some limitations – like the 65 536 methods per android project (Strange, huh). I faced that issue 2 weeks ago and I am still facing it.

I was using a third party SDK which was and is huge and that SDK broke my whole project. They were including the zxing source library which is also huge.

To fix that problem I started searching for minified versions of all libraries that SDK was using. I replaced the zxing with a minified jar and I managed to fight that issue. But still on 2.3 devices because my project is so huge with that damn SDK I still do not know what to do.

There I get a LinearAlloc exceeded capacity exception, which cannot be fixed so easily (That is because my project is so huge…)

Here are some interesting articles about it:

https://www.facebook.com/notes/facebook-engineering/under-the-hood-dalvik-patch-for-facebook-for-android/10151345597798920
https://medium.com/@rotxed/dex-skys-the-limit-no-65k-methods-is-28e6cb40cf71
http://www.birbit.com/how-to-solve-linearalloc-problem/

You may also like...