[英]Android Studio: Java Library Module Dependency Error
I've added a Java Library dependency module to the app module of my project. 我已经在项目的应用模块中添加了Java库依赖模块。 When I try to run the app I get this error:
当我尝试运行该应用程序时,出现以下错误:
...while parsing hai/shoplist/ItemBag.class 1 error; ...解析hai / shoplist / ItemBag.class 1错误时; aborting Error:Execution failed for task ':app:preDexDebug'.com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException: Process 'command 'C:\\ProgramFiles\\Java\\jdk1.8.0_05\\bin\\java.exe'' finished with non-zero exit value 1
错误中止:任务':app:preDexDebug'.exe执行失败.com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\\ ProgramFiles \\ Java \\ jdk1.8.0 _05 \\ bin \\ java.exe''完成,退出值非零1
I've tested the classes that I have in the module and I can even build it but the problem arises when I try to run the app. 我已经测试了模块中的类,甚至可以构建它,但是当我尝试运行该应用程序时就会出现问题。
Android doesn't support Java 8. Add to your library build.gradle: Android不支持Java8。将其添加到库build.gradle中:
sourceCompatibility = 1.7.
It should solve your problem. 它应该可以解决您的问题。
Due to Androids design, there is a limitation on how many methods your application may contain. 由于Android的设计,您的应用程序可以包含多少种方法受到限制。 You might have exceeded this amount.
您可能已经超过了这个数量。 To solve this, enabled multidex support as explained here .
要解决此问题,请按此处说明启用multidex支持。
More information about it be found in the Android developer docs . 有关它的更多信息,请参见Android开发人员文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.