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) ; }