解决Error:Android Dex: com.android.dex.DexIndexOverflowException: Cannot merge new index 65918 into a
错误:Error:Android Dex: com.android.dex.DexIndexOverflowException: Cannot merge new index 65918 into a non-jumbo instruction!
例如以下图:
直接原因是Java代码太多,jar包太多。
谷歌官方文档已经有解决方式:http://developer.android.com/intl/zh-cn/tools/building/multidex.html
eclipse的解决方式:在项目中的这个文件project.properties中加入一句话:dex.force.jumbo=true,如图:
Android studio 解决方式,须要几个步骤:
第一步,加入 multiDexEnabled = true,如图:
第二步。加入依赖于你的build.gradle支持MultiDex库。如图:
第三步分3个情况,
假设你没有创建自己的Application 类,在你的清单文件AndroidManifest.xml中配置android.support.multidex.MultiDexApplication就能够了。
android:name="android.support.multidex.MultiDexApplication"
假设你有自己的Application类了。让它继承 android.support.multidex.MultiDexApplication而不是android.app.Application
假设你的Application继承了其它的类,而且你不想改变或者没办法改变。依照以下的方法重写attachBaseContext()。
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
假设没有第二和第三步。可能有些手机执行时会报错,如图:
好了,又一次编译。能够通过了,又能够愉快的玩耍了……
解决Error:Android Dex: com.android.dex.DexIndexOverflowException: Cannot merge new index 65918 into a的更多相关文章
- com.android.dex.DexIndexOverflowException: Cannot merge new index 66299 into a non-jumbo instruction
打包时控制台输出: Error:Execution failed for task ':app:transformClassesWithDexForAll32Release'. > com.an ...
- DexIndexOverflowException: Cannot merge new index 66080 into a non-jumbo instruction!
问题 该问题是方法数超过了65536(DEX 64K problem),无法编译成单个dex文件. 解决方案 谷歌官方给出的解决方案 android { compileSdkVersion 21 bu ...
- Android Bug:Error:com.android.dex.DexException: Multiple dex files define Landroid/support/design/widget/CoordinatorLayout$LayoutParams;
项目编译通过,运行时出现异常: Error:com.android.dex.DexException: Multiple dex files define Landroid/support/desig ...
- Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/lidroid/xutils/task/TaskHandler;
Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files defi ...
- 解决com.android.dex.DexException: Multiple dex files define Lcom/google/gson/JsonSerializer;
我在开发Windows Azure的Mobile Service(隔天补上创建过程)的安卓客户端时,报出了com.android.dex.DexException: Multiple dex file ...
- Android Studio:Multiple dex files define Landroid/support/annotation/AnimRes
近期真的比較忙,一不小心博客又荒了两个月. 从今天起.决定重返csdn,多多纪录和分享. 先从一个近期被折磨的死去活来的问题. 由于升级了V4包,就一直报这个问题: com.android.dex.D ...
- Android Studio com.android.dex.DexException: Multiple dex files define(重复引用包),androiddefine
Android Studio com.android.dex.DexException: Multiple dex files define(重复引用包),androiddefine 如果你用Andr ...
- Android Unable to execute dex: method ID not in [0, 0xffff]: 65536 问题解决方法
开始一个新项目的时候,Build工程的时候一直报这个错误: 控制台报错误:Conversion to Dalvik format failed: Unable to execute dex: meth ...
- [转载] Android动态加载Dex机制解析
本文转载自: http://blog.csdn.net/wy353208214/article/details/50859422 1.什么是类加载器? 类加载器(class loader)是 Java ...
随机推荐
- Think Pad T410键盘溅水有惊无险
昨日不小心单位给配的T410溅水了,由于水不多,用餐巾纸擦干后就晾起来了. 大概过了6小时,心想现在该好了吧,于是按开机键,无效! 当时暗骂Thinkpad给LX做坏了,一点小水都挡不住,还敢号称防洒 ...
- Linux shell 提取文件名和目录名
${}用于字符串的读取,提取和替换功能,可以使用${} 提取字符串 1.提取文件名 [root@localhost log]# var=/dir1/dir2/file.txt [root@localh ...
- Simple TCP/IP Echo Server & Client Application in C#
1. TCP Server The server’s job is to set up an endpoint for clients to connect to and passively wait ...
- Python 3 解析 html
资料:https://docs.python.org/3/library/html.parser.html python 自带了一个类,叫 HTMLParser. 我们用的时候需要自己定义一个类,继承 ...
- js 实现图片的无缝滚动
js 实现图片的无缝滚动 CreateTime--2018年3月7日17:18:34 Author:Marydon 测试成功 <!DOCTYPE html> <html> ...
- java获取unicode码
public String toUNICODE(String s) { StringBuilder sb=new StringBuilder(); for(in ...
- 【laravel54】报错:No supported encrypter found (加密类未找到)
原因:配置环境未生产 key 密钥,直接cmd,进入项目根目录,执行:php artisan key:generate 即可
- 【LeetCode】73. Set Matrix Zeroes (2 solutions)
Set Matrix Zeroes Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do i ...
- FFmpeg进行屏幕录像和录音
文章转自:http://www.cucer.cn/2016/03/10/ffmpeg-screen-capture.html 有些时候我们需要对屏幕进行录制,比如制作视频教程,录制直播等.然而这方面的 ...
- mosquitto $SYS下topic
$SYS/broker/clients/connected