article

Ross@Amazon avatar image
Ross@Amazon posted

MultiDex Debugging

Summary

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.

trouble writing
output:
Too many field references: 131000; max is 65536.
You may try using --multi-dex option.

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

The following documentation provides further information on resolving multidex issues. There is a walkthrough on how to use the Android Support MultiDex library and the 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.

Avoiding Compile Errors When Submitting Your App

Too Many Methods: How to Avoid Compile Errors on Submission

Enable Multidex for Apps with Over 64K Methods

Keywords: MultiDex, Dalvik, Dex, Method Limit, 65536

submission testing certification
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Article

Contributors

rossbria contributed to this article

Related Articles