如何处理 android 方法总数超过 65536 . the number of method references in a .dex file exceed 64k
一:问题描述:
应用中的Dex 文件方法数超过了最大值65536的上限,简单来说,应用爆棚了.
二、解决方案:
方案1:使用插件化框架 比如: https://github.com/singwhatiwanna/dynamic-load-apk
方案2:分割Dex
三:分割 Dex 文件实现方法
1、相关链接
https://developer.android.com/tools/building/multidex.html#about
2、在app的 build.gradle 中
(1)在dependencies 中添加
compile 'com.android.support:multidex:1.0.1'
(2)在 defaultConfig 中添加
multiDexEnabled true
比如
defaultConfig {
applicationId "com.pegasus.map"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
signingConfig signingConfigs.config
multiDexEnabled true
}
(3)在 AndroidManifest.xml 中的 application 标签中添加
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
提示:如果你的应用程序继承 Application , 那么你需要重写
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this) ;
}
另外我的微信公众账号是: zhaoyanjun125
我会经常发一些我的些项目的感悟和编程技术。欢迎关注。
微信扫描二维码 关注我
如何处理 android 方法总数超过 65536 . the number of method references in a .dex file exceed 64k的更多相关文章
- Android工程方法数超过64k,The number of method references in a .dex file cannot exceed 64K.
最近将一个老的Eclipse项目转到Android Studio后,用gradle添加了几个依赖,项目可以make,但是一旦run就报错 Error:The number of method refe ...
- The number of method references in a .dex file cannot exceed 64K.(转)
前言 我一直都知道app里面的方法数是有限制的差不多64000,具体的就未曾考证了在遇到这个问题之前,一直以为这个一个多么遥远的距离其实并不是的,稍有不慎这个异常出来了当前并不是你真的有编写了64k的 ...
- flutter踩坑小记:The number of method references in a .dex file cannot exceed 64K.
The number of method references in a .dex file cannot exceed 64K. 这句话的意思翻译出来是:.dex文件中的方法引用数不能超过64K. ...
- Android开发 Error:The number of method references in a .dex file cannot exceed 64K.
在Android系统中,一个App的所有代码都在一个Dex文件里面.Dex是一个类似Jar的存储了多有Java编译字节码的归档文件.因为Android系统使用Dalvik虚拟机,所以需要把使用Java ...
- react-native安卓运行报错:The number of method references in a .dex file cannot exceed 64K.
错误原因:App里面方法数超过64K解决方法:在android/app/build.gradle中添加implementation 'com.android.support:multidex:1.0. ...
- Building Apps with Over 65K Methods(解决APP引用方法总数超过65536)
本文翻译自http://developer.android.com/intl/zh-cn/tools/building/multidex.html#about.主要介绍当我们Android App中函 ...
- Android方法引用超过65535的解决方式
//在app/build.gradle android { compileSdkVersion buildToolsVersion "24.0.1" defaultConfig { ...
- Android 方法数超过64k、编译OOM、编译过慢解决方案。
目前将项目中的leancloud的即时通讯改为环信的即时通讯.当引入easeui的时候 出现方法数超过上限的问题. 搜索一下问题,解决方法很简单. 这里简单记录一下,顺序记录一下此解决方案导致的另一个 ...
- (转载)Android 方法数超过64k、编译OOM、编译过慢解决方案。
Android 方法数超过64k.编译OOM.编译过慢解决方案. 目前将项目中的leancloud的即时通讯改为环信的即时通讯.当引入easeui的时候 出现方法数超过上限的问题. 搜索一下问题, ...
随机推荐
- [SDK2.2]Windows Azure Virtual Network (4) 创建Web Server 001并添加至Virtual Network
<Windows Azure Platform 系列文章目录> 在上一章内容中,笔者已经介绍了以下两个内容: 1.创建Virtual Network,并且设置了IP range 2.创建A ...
- Sql Server,如何去含有非数字的nvarchar,再转为为数值
菜鸟一枚,今天做项目时,突然遇到一个问题: 在数据库中中存放的nvarchar类型的“时间”,例如:‘08:00’,而我需要进行时间的范围比较,这时就想到了将nvarchar类型转化为int类型. 这 ...
- Android Studio导入项目非常慢的解决办法
问题 Android Studio目前已经更新到2.0 Preview 6了,作为Google大力推崇的开发工具,相对于Eclipse ADT有着不可比拟的优势.然而在实际使用时,依然有不少不爽的地方 ...
- UEditor的使用
一.引用CSS和JS: <meta http-equiv="Content-Type" content="text/html;charset=utf-8" ...
- windbg学习进阶之——windbg环境变量配置
接触性能调优以来一直想学下windbg分析dump,每次看老师几个命令就能找到很底层的问题原因那简直就是羡慕加崇拜啊~但是这接近一年了,愣是没啥进展呢,主要就是在今天整理的这部分卡住了...这理由找的 ...
- MEF入门之不求甚解,但力求简单能讲明白(四)
上一篇我们已经可以获取各种FileHandler的实例和对应的元数据.本篇,我们做一个稍微完整的文件管理器. 1.修改接口IFileHandler,传入文件名 namespace IPart { pu ...
- [控件] 加强版 TOneSelection (改良自 Berlin 10.1 TSelection)
本控件修改自 Delphi Berlin 10.1 的 TSelection (FMX.Controls.pas) 修改重点: 移动点显示在上方 增加(左中,上中,右中,下中)控制点,含原来的总共有 ...
- [教学] Firemonkey 之 StringGrid Header 自订显示
StringGrid Header 高度设定方法: uses FMX.Header; procedure TForm1.StringGrid1ApplyStyleLookup(Sender: TObj ...
- Scalaz(40)- Free :versioned up,再回顾
在上一篇讨论里我在设计示范例子时遇到了一些麻烦.由于Free Monad可能是一种主流的FP编程规范,所以在进入实质编程之前必须把所有东西都搞清楚.前面遇到的问题主要与scalaz Free的Free ...
- python2.x 默认编码问题
python2.x中处理中文,是一件头疼的事情.网上写这方面的文章,测次不齐,而且都会有点错误,所以在这里打算自己总结一篇文章. 我也会在以后学习中,不断的修改此篇博客. 这里假设读者已有与编码相关的 ...