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.谷 ...
随机推荐
- udhcpc和udhcpd移植
实现DHCP自动获取IP地址 前提:系统已经实现DNS(即使用ping www.baidu.com测试时能ping通). 1. 在内核中添加以下选项: Networking ---> [*] ...
- arcgis for android访问arcgis server上自己制作部署的地图服务
转自:http://gaomw.iteye.com/blog/1110437 本项目的开发环境是eclipse3.5 + ADT11插件+arcgis for andorid 插件 + arcgis ...
- Api项目压力测试知识荟萃
并发用户.在线用户和注册用户以及彼此之间的换算方法(估算模型).系统的最大并发用户数根据注册用户数来获得,换算方法一般是注册总人数的5%-20%之间:系统的并发数根据在线人数来获得,换算方法一般是在3 ...
- 《Data-Intensive Text Processing with mapReduce》读书笔记之二:mapreduce编程、框架及运行
搜狐视频的屌丝男士第二季大结局了,惊现波多野老师,怀揣着无比鸡冻的心情啊,可惜随着剧情的推进发展,并没有出现期待中的屌丝奇遇,大鹏还是没敢冲破尺度的界线.想百度些种子吧,又不想让电脑留下污点证据,要知 ...
- SVM 支持向量机
学习策略:间隔最大化(解凸二次规划的问题) 对于上图,如果采用感知机,可以找到无数条分界线区分正负类,SVM目的就是找到一个margin 最大的 classifier,因此这个分界线(超平 ...
- HW3.9
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- A Tour of Go Numeric Constants
Numeric constants are high-precision values. An untyped constant takes the type needed by its contex ...
- oracle中使用sql查询时字段为空则赋值默认
转至:http://www.th7.cn/db/Oracle/201501/86125.shtml oracle 通过 nvl( )函数sql 查询时为 空值 赋默认值 oracle 函数介绍之nvl ...
- css Spirtes 错位问题解决
本文为转载内容,原文链接: https://github.com/banricho/webLog/issues/1
- EF搜索数据自动将表名变复数问题
原因这个是自己生成的需要在model加Table 其他博主写了aweier2011