Android给出错误“无法在单个dex文件中容纳所请求的类” [英] Android gives error "Cannot fit requested classes in a single dex file"

查看:1314
本文介绍了Android给出错误“无法在单个dex文件中容纳所请求的类”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么但今天早上在我的手机上启动我的应用是不可能的。我收到此错误消息:

I don't know why but it's impossible to launch my app on my mobile this morning. I get this error message:


无法在单个dex文件中容纳所请求的类。尝试提供
主索引列表。

Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

#methods:68061> 65536消息{kind = ERROR,text =无法在单个dex文件中容纳请求的类。尝试提供main-dex列表。

# methods: 68061 > 65536 Message{kind=ERROR, text=Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

#methods:68061> 65536,sources = [未知源文件],工具

# methods: 68061 > 65536, sources=[Unknown source file], tool

我是Android新手,我不明白这个问题,我需要做什么?为什么我现在而不是之前遇到这个问题?

I'm really new to Android and I don't understand the problem and what I need to do? And why I get this problem now and not before?

推荐答案

build.gradle中添加依赖项 file:

implementation 'com.android.support:multidex:1.0.3'

build.gradle defaultConfig 部分添加:

multiDexEnabled true

此处有更多详情:错误:无法在单个dex文件中放入请求的类。尝试提供main-dex列表。 #methods:72477> 65536

这篇关于Android给出错误“无法在单个dex文件中容纳所请求的类”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆