---
title: Android app exceeds 64k multidex limit
source: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/troubleshoot/android-app-exceeds-64k-multidex-limit
---

## Problem

Your Android app exceeds the 64k limit for the total number of methods that can be referenced within a single [Dalvik Executable file (DEX)](https://developer.android.com/studio/build/multidex.html), including methods for frameworks, libraries, and your own Android app code. You see error messages from the agent such as these:

**Build time error message example**

````
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: 
java.util.concurrent.ExecutionException: com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded
```

````

**Run time crash message example**

````
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mobile.debug, PID: 12345
java.lang.NoClassDefFoundError: com.example.foobar.myapp.MainActivity
```

````

These exception errors typically occur with Android devices prior to [Android 5.0 (API level 21)](https://developer.android.com/about/versions/android-5.0.html), which requires the [multidex](https://developer.android.com/studio/build/multidex.html) support library.

## Solution

To fix build errors or runtime exceptions when using the latest Android build tool:

1.  Make sure you have the [latest Android agent version](https://docs.newrelic.com/docs/release-notes/mobile-release-notes/android-release-notes).
2.  Enable [multidex](https://developer.android.com/studio/build/multidex.html).
3.  Enable [Proguard or Dexguard](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/install-configure/configure-proguard-or-dexguard-android-apps) to optimize classes and methods in your DEX.
4.  If you still have problems with keeping your Android app under the 64k limit, use a [keepfile](https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.BuildType.html#com.android.build.gradle.internal.dsl.BuildType:multiDexKeepProguard).
