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种选择:

  1. 如果你没有创建自己的Application 类,在你的清单文件AndroidManifest.xml中配置android.support.multidex.MultiDexApplication就可以了。

    .... android:name="android.support.multidex.MultiDexApplication" ...

  2. 如果你有自己的Application类了,让它继承android.support.multidex.MultiDexApplication而不是android.app.Application


更多相关文章

  1. Mac与Android文件传输工具 Android File Transfer
  2. android 打开各种文件(setDataAndType)
  3. Android清单文件属性大全
  4. Android 文件夹命名规范 国际化资源
  5. android读取文件权限

随机推荐

  1. Android手机横竖屏幕切换时Activity的重
  2. 深入理解:Android(安卓)编译系统
  3. ffmpeg 编译android so库文件
  4. 通过经度和纬度算出距离
  5. ANDROID多点触控API接口的使用
  6. 如何实现手势缩放图片
  7. Android:Native C源码(NDK)如何使用sqlit
  8. AndroidX
  9. Scroll,
  10. Android应用程序执行流程