Conversion to Dalvik format failed:Unable toexecute dex: method ID not in [0, 0xffff]: 65536
Android 应用 (APK) 文件包含 Dalvik Executable (DEX) 文件形式的可执行字节码文件,其中包含用来运行您的应用的已编译代码。Dalvik Executable 规范将可在单个 DEX 文件内可引用的方法总数限制在 65,536,其中包括 Android 框架方法、内容库方法以及您自己代码中的方法。在计算机科学领域内,术语千(简称 K)表示 1024(或 2^10)。由于 65,536 等于 64 X 1024,因此这一限制也称为“64K 引用限制”。
解决方案
越过这一限制需要您将应用构建流程配置为生成多个 DEX 文件,这种配置称为 Dalvik 可执行文件分包配置。
将您的应用开发项目设置为使用 Dalvik 可执行文件分包配置需要对您的应用开发项目做几项修改。具体地讲,您需要执行以下步骤:
- 将您的 Gradle 构建配置更改为启用 Dalvik 可执行文件分包
- 修改您的清单以引用
MultiDexApplication类
android {
compileSdkVersion
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion
targetSdkVersion
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
但是,[ as + multi-dex ] - 65536 != 0 这是必然的,如何规避?
规避 64K 限制
- 检查您的应用的直接和传递依赖项 - 确保您在应用中使用任何庞大依赖库所带来的好处大于为应用添加大量代码所带来的弊端。一种常见的反面模式是,仅仅为了使用几个实用方法就在应用中加入非常庞大的内容库。减少您的应用代码依赖项往往能够帮助您规避 dex 引用限制。
- 通过 ProGuard 移除未使用的代码 - 为您的应用配置 ProGuard 设置以运行 ProGuard,并确保为发布构建启用压缩。启用压缩可确保您交付的 APK 不含有未使用的代码。
Conversion to Dalvik format failed:Unable toexecute dex: method ID not in [0, 0xffff]: 65536的更多相关文章
- Android Unable to execute dex: method ID not in [0, 0xffff]: 65536 问题解决方法
开始一个新项目的时候,Build工程的时候一直报这个错误: 控制台报错误:Conversion to Dalvik format failed: Unable to execute dex: meth ...
- Unable to execute dex: method ID not in [0, 0xffff]: 65536
http://ingramchen.io/blog/2014/09/prevention-of-android-dex-64k-method-size-limit.html
- Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ...
Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ... 这个错误是因为有两个相 ...
- Conversion to Dalvik format failed: Unable to execute dex: null
[2013-11-19 14:18:48 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check th ...
- Conversion to Dalvik format failed: Unable to execute dex
最近莫名奇妙遇到“Conversion to Dalvik format failed: Unable to execute dex”错误,stackoverflow以后得到结果 把项目中classp ...
- 【Android】Tips for Android developer: “Conversion to Dalvik format failed: Unable to execute dex: null”
Androiddeveloper, I have met a strange problem when I want use a third party jar, it remained me tha ...
- Android 报错:Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
在android高版本开发环境(sdk 4.4)导入低版本(sdk 3.0)的工程时编译报错,报错信息如:Conversion to Dalvik format failed: Unable to e ...
- eclipse android程序运行报错:Conversion to Dalvik format failed: Unable to execute dex:
[2013-06-19 16:59:01 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support ...
- Android学习笔记----解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
同时在工程中引入了多个第三方jar包,导致调用的方法数超过了android设定的65536个(DEX 64K problem),进而导致dex无法生成,也就无法生成APK文件. 解决办法如下: 1.谷 ...
随机推荐
- 一行代码搞定Adapter
15年Google I/O大会发不了三个重要支持库 >Material design (Android Support Design) >百分比布局:Percent support lib ...
- Growling Gears
http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11587 G Growling GearsThe Best A ...
- [King.yue]VS2012 无法启动IIS Express Web服务器的解决方案
打开VS2012解决方案资源管理器 -> 点选 Web 项目选择 -> 属性 -> Web -> 选择“使用 Visual Studio 开发服务器” -> 选中“自动分 ...
- EF RepositoryBase 参考示例【转】
1.定义泛型类 namespace Crm.Data.Logic.Repository{ public abstract class AbstractRepository<TC, T> ...
- asp.net的运行内幕
每当浏览器向IIS发送一个页面请求的时候,相应的网页就会被编译成DLL文件,然后由JIT来运行这个DLL文件,最后将运行结果发送给客户端.一旦网页发送了变化,下次再请求页面的话,网页又会被重新被编译成 ...
- 【原】1.1RDD源码解读(一)
1.RDD(Resilient Distributed DataSet)是Spark生态系统中最基本的抽象,代表不可变的.可并行操作的分区元素集合.RDD这个类有RDD系列所有基本的操作,比如map. ...
- (6)s3c2440用I2C接口访问EEPROM
在前面阅读理解了I2C的官方协议文档后,就拿s3c2440和EEPROM来验证一下. 本来是想用s3c2440的SDA和SCL管脚复用为GPIO来模拟的,但在没有示波器的情况下搞了一周,怎么都出不来, ...
- 常用oracle查询总结
--查询表空间使用情况 SELECT UPPER(F.TABLESPACE_NAME) "表空间名", D.TOT_GROOTTE_MB "表空间大小(M)", ...
- (贪心5.1.2)POJ 2287 Tian Ji -- The Horse Racing
/* * POJ_2287.cpp * * Created on: 2013年10月9日 * Author: Administrator */ #include <iostream> #i ...
- 2015年10个最佳Web开发JavaScript库
2015年10个最佳Web开发JavaScript库 现在的互联网可谓是无所不有,有大量的JavaScript项目开发工具充斥于网络中.我们可以参考网上的指导来获取构建代码项目的各种必要信息.如果你是 ...