I don't know why but it's impossible to launch my app on my mobile this morning. I get this error message:
Cannot fit requested classes in a single dex file. Try supplying a main-dex list.
# methods: 68061 > 65536 Message{kind=ERROR, text=Cannot fit requested classes in a single dex file. Try supplying a main-dex list.
# methods: 68061 > 65536, sources=[Unknown source file], tool
I'm really new to Android and I don't understand the problem and what I need to do? And why I get this problem now and not before?
To Solve Cannot fit requested classes in a single dex file. Try supplying a main-dex list Error You just need to Add dependency androidx. multidex:multidex:2.0.
Android applications by default have SingleDex support which limits your application to have only 65536 methods(references). So multidexEnabled = true simply means that now you can write more than 65536 methods(references) in your application.
Add dependency in build.gradle
file:
implementation 'androidx.multidex:multidex:2.0.1'
In build.gradle
's defaultConfig
section add:
multiDexEnabled true
More details here: Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536
Running RN 0.62 and this worked for me with successful build.
Update build.gradle
classpath('com.android.support:multidex:1.0.3')
Update defaultConfig
multiDexEnabled true
After those 2 changes, restart the gradle build again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With