Android开发 方法总数超过64K时,dex分割(Android Studio)
来源:互联网 发布:日立电梯解密软件 编辑:程序博客网 时间:2024/06/05 17:32
最近项目功能越做越大,引入了不少第三方库,在低版本手机上编译,遇到:
rror:The number of method references in a .dex file cannot exceed 64K.Error:Execution failed for task ':app:transformClassesWithDexForRelease'.> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '*******\jdk1.8.0_77\bin\java.exe'' finished with non-zero exit value 2‘’?
只能分割dex。1、相关链接https://developer.android.com/tools/building/multidex.html#about
2、在app的 build.gradle 中(1)在dependencies 中添加compile 'com.Android.support:multidex:1.0.0'
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:multidex:1.0.0'}
(2)在 defaultConfig 中添加multiDexEnabled true
defaultConfig {applicationId "com.dex.test"minSdkVersion 14targetSdkVersion 21versionCode 1versionName "1.0"// Enabling multidex support.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.vieboo.test"> <application ... android:name="android.support.multidex.MultiDexApplication"> ... </application></manifest>
提示:如果你的应用程序继承 Application , 那么你需要重写并继承 MultiDexApplication,AndroidManifest.xml 中的application name则填写你重写的Application类就好:
/** * 分割 Dex 支持* @param base*/@Overrideprotected void attachBaseContext(Context base) {super.attachBaseContext(base);MultiDex.install(this);}
如有转载请注明出处:http://ioclub.info/topic/573d2dbc8ae552f60443e204,谢谢~
0 0
- Android开发 方法总数超过64K时,dex分割(Android Studio)
- Android当方法总数超过64K时(Android Studio)
- Android当方法总数超过64K时(Android Studio)
- Android当方法总数超过64K时(Android Studio)
- Android DEX 方法超过64K限制
- 如何处理 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的两种办法
- Android DEX方法超过64K和gradle编译OOM解决方案
- android studio DEX 方法超过64K限制和gradle编译OOM问题解决,异常名:Error:Execution failed for task ':app:dexDebug'. >
- android studio DEX 方法超过64K限制和gradle编译OOM问题解决,异常名:Error:Execution failed for task ':app:dexDebug'. >
- 安卓应用方法数超过64k解决办法:分割Dex
- (配置超过64K方法的应用程序)com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- android方法数超过64k解决方法
- Android开发方法数超过64k(65k)解决办法
- Android Studio 中方法数65536 或超过64K的解决方案
- Android studio 项目构建八|配置方法数超过 64K 的应用
- 【Android】如何解决dex方法数超过64k(The number of method references in a .dex file cannot exceed 64K)及连带问题
- <读书笔记> Android dex文件 64k 方法数限制
- 非计算机专业硕士研究生的程序员求职历程
- centos6.5 断电重新启动后的unexpected
- abs(数论)
- opencv cvlogpolar
- 最好的json在线解析网站
- Android开发 方法总数超过64K时,dex分割(Android Studio)
- hdu 5119 Happy Matt Friends
- 关于Java调用exe,bat
- Eclipse-oracle-jdbc数据库连接
- 将java程序安装成windows服务
- 网络框架Volley原理分析
- kettle实现数据库迁移之oracle到mysql
- JSON请求后默认发送布尔默认值false
- Light OJ 1349 Aladdin and the Optimal Invitation