Android(安卓)Studio 错误 com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
然后在网上也搜索了一下解决办法,但并不是很满意,后来自己研究了一下,下面说一下解决方法:
第1步
添加依赖于你的build.gradle支持MultiDex库
dependencies { ... compile 'com.Android.support:multidex:1.0.1' ... }
第2步
在buildType或productFlavor中开启multiDexEnabled。
defaultConfig { ... multiDexEnabled true ... }
现在,根据你的项目情况,你有2种选择:
-
如果你没有创建自己的Application 类,在你的清单文件AndroidManifest.xml中配置
android.support.multidex.MultiDexApplication
就可以了。.... android:name="android.support.multidex.MultiDexApplication" ...
- 如果你有自己的Application类了,让它继承
android.support.multidex.MultiDexApplication
而不是android.app.Application
更多相关文章
- Android开发学习清单
- Android(安卓)service的开启和绑定,以及调用service的方法
- Android清单文件属性大全
- 解决activity加上Theme.Translucent.NoTitleBar 页面跳转显示桌
- Android(安卓)支持 Java8
- 判断Android的WIFI与GPS状态,并引导用户前去开启GPS与WIFI设置
- android Mainifest权限设置清单
- 【Android】 ListView之setEmptyView的问题
- ListView之setEmptyView的问题