Androidx MutliDex: The number of method references in a .dex file cannot exceed 64K

Modify the module-level build.gradle file to enable multidex and add the multidex library as a dependency, as shown here:

android {
    defaultConfig {
        minSdkVersion 16 
        targetSdkVersion 28
        multiDexEnabled true

dependencies {
  implementation ''

If you do not override the Application class, edit your manifest file to set android:name in the tag as follows:

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

If you do override the Application class, change it to extend MultiDexApplication (if possible) as follows:

import androidx.multidex.MultiDexApplication;
public class MyApplication extends MultiDexApplication { ... }

Or if you do override the Application class but it's not possible to change the base class, then you can instead override the attachBaseContext() method and call MultiDex.install(this) to enable multidex:

public class MyApplication extends SomeOtherApplication {
  protected void attachBaseContext(Context base) {