Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, including Android framework methods, library methods, and methods in your own code. Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.
Receiving one of the following errors mean that the number of methods the application is using must be reduced or the application must use multidexing.
Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
trouble writing output: Too many field references: 131000; max is 65536. You may try using --multi-dex option.
Mike Hines has posted a blog post on how to avoid running into this error. That post is available at :
This will walk you through how to use the Android Support MultiDex library, and what switches you can pass in your build.gradle file in order to reduce your method count per dex file. In addition to other best practices when dealing with reducing your overall method count in your resulting APK file.
Keywords: MultiDex, Dalvik, Dex, Method Limit