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:自己遇到的异常总结下

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