Error text
Cannot fit requested classes in a single dex file (# fields: 70000 > 65536) D8: The number of methods in the dex file exceeds 65536
Cannot fit requested classes in a single dex file (# fields: 70000 > 65536) D8: The number of methods in the dex file exceeds 65536
One dex file can hold at most 65,536 methods. When the app and its libraries exceed it, D8 stops the build.
minSdk 21 or higher just set multiDexEnabled = true.androidx.multidex:multidex and call MultiDex.install in your Application class.isMinifyEnabled = true: unused methods are removed.android {
defaultConfig {
minSdk = 21
multiDexEnabled = true
}
}
dependencies { implementation("androidx.multidex:multidex:2.0.1") } // yalnız minSdk < 21Add a big library through its specific module, not as a whole.
Author and license: Nibras Code