How to Solve Dex 65K Method Exception

While you gradually develop your application, you most probably would be encountered by the famous unable to execute dex exception.

 Conversion to Dalvik format failed:
Unable to execute dex: method ID not in [0, 0xffff]: 65536

or

 Conversion to Dalvik format failed:
Unable to execute dex: method ID not in [0, 0xffff]: 65536

You get this error mainly because there is a limitation on dalvik executable files and apparently the limit is 65536 which is 2^16 (two to the power sixteen).

This problem is also known as 65k method limit. So this limit is applied on the method count of your application. Android sdk methods are also counted. Therefore it is not that hard to reach out that limit. If you add a few third-party libraries to your gradle file and also android support libraries and google play services library, eventually you will hit the limit.

Continue reading How to Solve Dex 65K Method Exception