☰ Menu

RESOLVED - The number of method references in a .dex file cannot exceed 64k

As suggested you can use the multidex support.

Just add these lines in the module/build.gradle:

android {

    defaultConfig {

        // Enabling multidex support.
        multiDexEnabled true

dependencies {
  //with support libraries
  implementation ''
  //with androidx libraries
  //implementation 'androidx.multidex:multidex:2.0.1'

Also in your Manifest add the MultiDexApplication class from the multidex support library to the application element

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android=""

            <!-- If you are using androidx use android:name="androidx.multidex.MultiDexApplication" -->

            <!--If you are using your own custom Application class then extend -->
            <!--MultiDexApplication and change above line as-->
            <!--android:name=".YourCustomApplicationClass"> -->


If you are using your own Application class, change the parent class from Application to MultiDexApplication. If you can't do it, in your Application class override the attachBaseContext method with:

protected void attachBaseContext(Context newBase) {

Another solution is to try to remove unused code with ProGuard - Configure the ProGuard settings for your app to run ProGuard and ensure you have shrinking enabled for release builds.