[Android] Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

在 “build apk” 或 “make project” 都失敗,Error Message:

Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

解法:

The problem lies in the Multidex. You must add the library in the app gradle :

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

After, add in the defaultConfig of the app gradle :

multiDexEnabled true

Your Application must be of the Multidex type.. You must write it in the manifest :

android:name=".MyApplication"

“MyApplication” must be either the Multidex class, or it must extend it.

相關文章

寫留言

你的電子郵件位址並不會被公開。 必要欄位標記為 *