[Resolution] The number of method references in a .dex file can not exceed 64K.

By | December 16, 2016


  • Android Studio : 2.1.2
  • minSdkVersion 15 (Android 4.0.3 APIs)
  • Google Maps Activity


I had to work on Google Maps, so I selected Google Maps Activity as the default activity and built the project. It is not the case that I put the code differently, but the following error occurs and the build can not be done.


Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

When you build the Android project, you will convert it to the byte code that was run in the VM, which will be represented in .dex. However, this .dex has a 64KB limitation, so if it exceeds this size, the above error will occur.

In the case of the error below, I only incremented the grade heap to 2048MB in the same code, but the error of the other text was displayed. The bottom line is the same.


Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’.

> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536


To solve this problem, you should use the multidex support library to use muldidex. However, Google’s guide below shows two ways to solve this problem: Android 5.0 (Lollipop). However, since it is common to usually support the geallybean
“Multidex support prior to Android 5.0” will be your solution.

Here’s how to apply the Multidex support library:

1. Insert the following into build.gradle.

android {
    defaultConfig {
        // Enabling multidex support.
        multiDexEnabled true

dependencies {
    compile 'com.android.support:multidex:1.0.0'

2. Insert the following into AndroidManifest.xml.


3. If the package is not recognized, go to [File> Project Structure] and check if com.android.support.multidex is included. If not, add it.

4. If it still does not work, go to [Build> Rebuild Project].

5. After completing the above steps, you can confirm that the build is completed normally without any errors. You can see that the dex file is split into two as shown below.


To confirm that dex is separated, find the location of apk by changing to zip and extracting it by referring to the following article.

Leave a Reply

Your email address will not be published. Required fields are marked *