本文主要是介绍android 报错Cannot fit requested classes in a single dex file. Try supplying a main-dex list,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
添加新的类库之后编译报错
解决办法:
1. 在当前项目的build.gradle里dependencies添加
implementation 'com.android.support:multidex:1.0.3'
如图
2.在当前项目的build.gradle文件里defaultConfig里添加
multiDexEnabled true
如图
3.在AndroidMainfest.xml中application下添加代码
android:name="android.support.multidex.MultiDexApplication"
如图
三步解决,运行即可
这篇关于android 报错Cannot fit requested classes in a single dex file. Try supplying a main-dex list的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!