1 遇到的问题

开发中遇到下面一个运行错误:

Error:Execution failed for task ':hello_v1.0:transformClassesWithDexForAdh5Debug'.> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 2> 

如果使用了友盟或者百度地图,则还会在运行时报下面一排警告:

Warning:Ignoring InnerClasses attribute for an anonymous inner class(org.dom4j.swing.LeafTreeNode$1) that doesn't come with anassociated EnclosingMethod attribute. This class was probably produced by acompiler that did not target the modern .class file format. The recommendedsolution is to recompile the class from source, using an up-to-date compilerand without specifying any "-target" type options. The consequence of ignoringthis warning is that reflective operations on this class will incorrectlyindicate that it is *not* an inner class.

如下图:

2 原因

博主是在集成一个库的时候,编译通过,运行时报上面的错误,可是之前集成过一次,明明可以运行的,同样的方法再次集成就不行了。最后发现是因为方法数太多了,超过了限制

3 解决方法

在build.gradle中添加下面代码:

defaultConfig {    ......       multiDexEnabled true}

4 参考链接

我是参考下面的博客解决问题的:

http://blog.csdn.net/zouchengxufei/article/details/50011237

顺便贴一下StackOverflow上关于这个问题的解答:

http://stackoverflow.com/questions/33095536/apptransformclasseswithdexfordebug-com-Android-build-transform-api-transf

5 转载请注明来自”梧桐那时雨”的博客:http://blog.csdn.net/fuchaosz/article/details/51398071

Tips:
如果觉得这篇博客对你有帮助或者喜欢博主的写作风格,就给博主留个言或者顶一下呗,鼓励博主创作出更多优质博客,Thank you.

更多相关文章

  1. 运行Android(安卓)Studio时,APP安装失败--Installation failed wi
  2. Android判断程序是否第一次运行
  3. [置顶] Android学习网站和博客汇总
  4. android 判断是否第一次进入欢迎页
  5. android 状态栏显示运行图标
  6. 使用Android(安卓)Studio可能会遇到的问题
  7. android 判断是否第一次进入欢迎页
  8. android 如何判断程序是否在前台运行
  9. Android(java.lang.NullPointerException)

随机推荐

  1. 【Android(安卓)Basic Training - 02】基
  2. Android - 获取控件(包括状态栏与标题栏)宽
  3. http://www.jianshu.com/p/7e46fe7485bb
  4. Android 关于build.gradle的一些配置问题
  5. Android中隐藏标题栏和状态栏
  6. flutter 混合开发
  7. protected-broadcast 规范使用(ERROR: Se
  8. Android 手机获取时区
  9. Android EventBus二三事
  10. Android编译打包-gradle task 的依赖