Androidx MutliDex: The Number Of Method References In A .dex File Cannot Exceed 64K
Answer :
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 'com.android.support:multidex:1.0.3' }
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="http://schemas.android.com/apk/res/android" package="com.example.myapp"> <application android:name="android.support.multidex.MultiDexApplication" > ... </application> </manifest>
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 { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } }
Comments
Post a Comment