错误:无法在单个 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 :
实现'com.android.support:multidex:1.0.3'
2:在app 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屋!
查看全文