Error Cannot Fit Requested Classes (ECFRC)

Hello guys, this time I want to share a case when I was working on a chat app. At that time, I was trying a scrap library or legacy code (meaning a 3rd party library that had been abandoned and there were no signs of follow-up development), even so I thought the functionality was still working and I really needed it, so I finally decided to use it in my project.

Resolve Error:Cannot fit requested classes in a single dex file

Well, as usual the implementation process is not as smooth as black pink thighs, I found an error like this,

"null, Cannot fit requested classes in a single dex file (# methods: 66445 > 65536)"

The solution to this is to enable multi dex support in the Android app. The following steps are how to do it.

1. Add androidx.multidex:multidex library to app's build.gradle

dependencies {
...etc...
implementation 'androidx.multidex:multidex:2.0.1
...etc...
}

2. Still in the same file (app's build.gradle), enable the multiDexEnabled property.

android {
  defaultConfig {
    ...etc...
    multiDexEnabled true
    ...etc...
  }
}

Now, compile your Android app, it should no longer produce dex errors.


Post a Comment

Previous Next

نموذج الاتصال