解決method ID not in [0, 0xffff]: 65536錯誤的方法

最近在做圖片加載的時候出現Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536不知道怎麼解決,於是百度了很久才找到答案,在此記錄一下,好像是出現了超出了64k的限制
在 app 的build.gradle下添加兩句就可以了

 defaultConfig {
...
multiDexEnabled true
    }`

dependencies {
compile ‘com.android.support:multidex:’
}
“`
點擊一下Sync Now重新編譯一下就可以

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章