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

猜你喜欢

转载自www.cnblogs.com/inthecloud/p/12124136.html