Error:The number of method references in a .dex file cannot exceed 64K. 解決方案

Error:The number of method references in a .dex file cannot exceed 64K.

Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html


項目過大,方法數超出限制,這一問題有的找好久找不到問題。

解決這個問題的方法就是

在gradle中添加依賴

compile 'com.android.support:multidex:1.0.0'
然後在

defaultConfig {
    // 突破65535個方法限制,有風險,啓動可能會造成ANR
    multiDexEnabled true
}

如果你用了自己的application需要繼承 MultiDexApplication

ps:自己遇到的異常總結下

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