I updated my app to use multidex
multiDexEnabled true
and upped my minSdkVersion to 21:
ext {
buildToolsVersion = "30.0.3"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 30
javaVersion = JavaVersion.VERSION_1_8
}
so when I start building my app I first get this
> Configure project :app
[SafeDK] Your project has been updated to support Multi-Dex!
With Multi-Dex support you can use as many methods as you like in your application (no 65K method limit)
but later the build fails with:
[SafeDK-ERROR] Main Dex exceeded 65K methods or field references, Exception: Main Dex exceeded 65K methods or field references
why is that? how is this contradiction possible?
According to android docs:
So you do not need:
Still if you face this issue make sure:
You also have:
In the manifest:
Finlly:
If you are using your own Application class, change the parent class from Application to MultiDexApplication.