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

查看:38
本文介绍了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.

# 方法:68061 >65536 消息{种类=错误,文本=无法在单个 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.

# 方法: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 文件中添加依赖:

Add dependency in build.gradle file:

implementation 'androidx.multidex:multidex:2.0.1'

build.gradledefaultConfig 部分添加:

In build.gradle's defaultConfig section add:

multiDexEnabled true

更多详情:错误:无法在单个 dex 文件中容纳请求的类.尝试提供主 dex 列表.# 方法:72477 >65536

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

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