Android gives error "Cannot fit requested classes in a single dex file"

KevinB :

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?

Gokul Nath KP :

Add dependency in build.gradle file:

implementation 'com.android.support:multidex:1.0.3'

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=35415&siteId=1