groovy
dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
}
public class MyApplication extends MultiDexApplication {
// ...
}
@Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
// ...
}
# Keep the support library classes
-keep class android.support.multidex.** { *; }
# Keep the classes required by Multi Dex Library
-keep public class androidx.multidex.MultiDexInstaller { public *; }
-keep public class androidx.multidex.MultiDexExtractor { public *; }
# Additional configuration when using ProGuard with Instant Run
-dontoptimize
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepattributes InnerClasses,EnclosingMethod
-keepattributes Signature
-keepattributes Exceptions
# Disable resource shrinking
-keepresources string/* !androidx/multidex/**/*
# You may need to keep other classes and methods based on your app's specific requirements