如何处理 android 方法总数超过 65536 . the number of method references in a .dex file exceed 64k
2017-05-16 14:43
666 查看
一:问题描述:
应用中的Dex 文件方法数超过了最大值65536的上限,简单来说,应用爆棚了.
方案2:分割Dex
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
比如
(3)在 AndroidManifest.xml 中的 application 标签中添加
提示:如果你的应用程序继承 Application , 那么你需要重写
另外我的微信公众账号是: zhaoyanjun125
我会经常发一些我的些项目的感悟和编程技术。欢迎关注。
微信扫描二维码 关注我
应用中的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
比如
1 defaultConfig { 2 applicationId "com.pegasus.map" 3 minSdkVersion 15 4 targetSdkVersion 23 5 versionCode 1 6 versionName "1.0" 7 signingConfig signingConfigs.config 8 multiDexEnabled true 9 }
(3)在 AndroidManifest.xml 中的 application 标签中添加
1 <?xml version="1.0" encoding="utf-8"?> 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 package="com.example.android.multidex.myapplication"> 4 <application 5 ... 6 android:name="android.support.multidex.MultiDexApplication"> 7 ... 8 </application> 9 </manifest>
提示:如果你的应用程序继承 Application , 那么你需要重写
1 @Override 2 protected void attachBaseContext(Context base) { 3 super.attachBaseContext(base); 4 MultiDex.install(this) ; 5 }
另外我的微信公众账号是: zhaoyanjun125
我会经常发一些我的些项目的感悟和编程技术。欢迎关注。
微信扫描二维码 关注我
相关文章推荐
- 如何处理 android 方法总数超过 65536 . the number of method references in a .dex file exceed 64k
- 【Android】-- 处理 android 方法总数超过 65536 . the number of method references in a .dex file exceed 64k的两种办法
- 方法数超过64K:The number of method references in a .dex file cannot exceed 64K.
- Android开发 Error(建议收藏下来以备不时之需):The number of method references in a .dex file cannot exceed 64K.
- Android “64k”的问题以及解决方案 Error:The number of method references in a .dex file cannot exceed 64K.
- Android Error:The number of method references in a .dex file cannot exceed 64K.
- The number of method references in a .dex file cannot exceed 64k API 17
- The number of method references in a .dex file cannot exceed 64K
- Error:The number of method references in a .dex file cannot exceed 64K 问题解决
- Error:The number of method references in a .dex file cannot exceed 64K. 解决方案
- Error:The number of method references in a .dex file cannot exceed 64K.
- The number of method references in a .dex file cannot exceed 64K.
- Android开发 Error:The number of method references in a .dex file cannot exceed 64K.
- The number of method references in xxx.dex file cannot exceed 64K问题
- Error:The number of method references in a .dex file cannot exceed 64K.
- The number of method references in a .dex file cannot exceed 64K.(转)
- AndroidStudio线上APK打包.Error:The number of method references in a .dex file cannot exceed 64K.
- The number of method references in a .dex file cannot exceed 64K. Error 解决方案
- The number of method references in a .dex file cannot exceed 64K.
- Android SDK低版本切换高版本错误 Error:The number of method references in a .dex file cannot exceed 64K.