Android开发 方法总数超过64K时,dex分割(Android Studio)
2016-08-01 20:41
411 查看
最近项目功能越做越大,引入了不少第三方库,在低版本手机上编译,遇到:
只能分割dex。1、相关链接https://developer.android.com/tools/building/multidex.html#about
2、在app的 build.gradle 中(1)在dependencies 中添加
(2)在 defaultConfig 中添加
(3)在 AndroidManifest.xml 中的 application 标签中添加 :
提示:如果你的应用程序继承 Application , 那么你需要重写并继承 MultiDexApplication,AndroidManifest.xml 中的application name则填写你重写的Application类就好:
如有转载请注明出处:http://ioclub.info/topic/573d2dbc8ae552f60443e204,谢谢~
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 14 targetSdkVersion 21 versionCode 1 versionName "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 */ @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }
如有转载请注明出处:http://ioclub.info/topic/573d2dbc8ae552f60443e204,谢谢~
相关文章推荐
- Android当方法总数超过64K时(Android Studio)
- 如何处理 android 方法总数超过 65536 . the number of method references in a .dex file exceed 64k
- Android当方法总数超过64K时(Android Studio)
- 【Android】-- 处理 android 方法总数超过 65536 . the number of method references in a .dex file exceed 64k的两种办法
- Android当方法总数超过64K时(Android Studio)
- 如何处理 android 方法总数超过 65536 . the number of method references in a .dex file exceed 64k
- 【Android】如何解决dex方法数超过64k(The number of method references in a .dex file cannot exceed 64K)及连带问题
- 安卓应用方法数超过64k解决办法:分割Dex
- DEX 方法超过64K限制和gradle编译OOM问题解决,异常名:Error:Execution failed for task ':app:dexDebug'. > com.android.ide
- 安卓学习笔记---安卓应用方法数超过64k解决办法:分割Dex
- 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'. >
- Android DEX方法超过64K和gradle编译OOM解决方案
- Android开发方法数超过64k(65k)解决办法
- (配置超过64K方法的应用程序)com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- Android Studio下Android应用开发集成百度语音合成使用方法样例
- (2.2.8.4 & 4.4.15.1)Gradle:multiDexEnabled之DEX 方法超过64K限制和gradle编译OOM问题解决
- Android dex file cannot exceed 64K错误,使用Mutidex解决Dex超出方法数的限制
- 查看android项目方法总数的方法(防止超过65535限制)
- Android开发方法数超过65535的解决办法