Hi friends,
Android developers now face this error when build application.
Cannot fit requested classes in a single dex file (# methods: 72648 > 65536)
What are dex files: Android app (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app.
Reason for this exception: The DEX specification limits the total number of methods that can be referenced within a single DEX file to 65,536 (64K reference limit) —including Android framework methods, library methods, and methods in your own code.
Step1 >>> You must add the library in the app gradle :
implementation 'com.android.support:multidex:1.0.3'
For AndroidX
implementation 'androidx.multidex:multidex:2.0.1'
Step2 >>> defaultConfig of the app gradle :
multiDexEnabled true
Step3 >>> Your Application must be of the Multidex type.Add this line in manifest <application>:
android:name=".MyApplication"
Comments
Post a Comment