错误:无法在单个dex文件中容纳请求的类(#方法:67593> 65536) [英] Error: Cannot fit requested classes in a single dex file (# methods: 67593 > 65536)
本文介绍了错误:无法在单个dex文件中容纳请求的类(#方法:67593> 65536)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何解决我在Android Studio中遇到的错误:
How to solve this error I'm getting in Android Studio:
错误:无法在单个dex文件中容纳请求的类(#方法:67593> 65536)
Error: Cannot fit requested classes in a single dex file (# methods: 67593 > 65536)
现在不能建立我的项目
推荐答案
执行此 4 步骤
1 :根据应用程序build.gradle的依赖项添加此库:
1: Add this library in dependencies of the app build.gradle :
implementation 'com.android.support:multidex:1.0.3'
2 :添加应用程序build.gradle的defaultConfig:
2: Add in the defaultConfig of the app build.gradle :
defaultConfig {
//other configs
multiDexEnabled true //add this line
}
3 :像这样创建新的Java类:
3: Create new Java class like this :
public class ApplicationClass extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
}
}
4 :将其添加到清单(在应用程序标记中):
4: Add this to your manifest (in application tag):
<application
android:name=".ApplicationClass"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
这篇关于错误:无法在单个dex文件中容纳请求的类(#方法:67593> 65536)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文