flutter引入第三方包報錯:The number of method references in a .dex file cannot exceed 64K.


 

 

 

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

 這句話百度翻譯告訴我的意思是   .dex文件中的方法引用數不能超過64K。

解決方法:

在android/app/build.gradle中添加

dependencies中添加
implementation 'com.android.support:multidex:1.0.3'
defaultConfig中添加
multiDexEnabled true

 

這樣基本可以了

 

 

Flutter的忽略

原生安卓可能還需要寫一個application,添加如下代碼

@Override
     protected void attachBaseContext(Context base) {
         super.attachBaseContext(base);
        MultiDex.install(this) ;
     }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM