com.android.dex.DexIndexOverflowException:方法ID不在[0,0xffff]中:在Android Studio中为65536 [英] com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 in android studio

查看:82
本文介绍了com.android.dex.DexIndexOverflowException:方法ID不在[0,0xffff]中:在Android Studio中为65536的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个android项目.当我将其导入eclipse时.它工作正常.但是,当我将其导入Android Studio时,它会提供:-

I have and android project. When i import it to eclipse . it works fine . But when i imported it to Android studio its giving :-

com.android.dex.DexIndexOverflowException:方法ID不在[0,0xffff]中:65536

com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

构建时出错.一个项目甚至有可能在Eclipse和Android Studio中表现不同.在两种情况下(是/否),我该如何解决

error while building . Is it even possible for a project to behave diffrently in eclipse and Android Studio . In both case (Yes / No) , how do i resolve it

我已经检查了build.gradle文件中的依赖项.所有依赖项都与我在Eclipse中使用的依赖项相同.

I have checked my build.gradle file for dependencies . All the dependencies are same as what i am using in eclipse.

推荐答案

Android预先定义了方法 65536 的上限.

Android has a pre-defined upper limit of Methods of 65536.

最常见的原因是使用完整的Google Play服务库,而不仅仅是您需要的子集,例如设计,卡片视图,地图等.

The most common cause of this is using the full google play services library, instead of just the subset you need, eg design, cardview, maps etc.

如果不是这种情况,请使用 multidex 库,该库可以提供更大的限制.看这里: http://developer.android.com/tools/support-library/features.html#multidex

If this is not the case, then use the multidex library, which enables a bigger limit. See here: http://developer.android.com/tools/support-library/features.html#multidex

基本上就是这样:

com.android.support:multidex:1.0.0

这篇关于com.android.dex.DexIndexOverflowException:方法ID不在[0,0xffff]中:在Android Studio中为65536的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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