Error: Execution failed for task': app: dexdebug'.> com. android. ide. common. process. ProcessException,
Exception Log:
Error: Execution failed for task': app: dexdebug '.
> Com. android. ide. common. process. ProcessException: org. gradle. process. internal. ExecException: Process 'command'/Library /...... /Java "finished with non-zero exit value 2
Error cause:
This exception occurs during Android Studio compilation and running, because duplicate jar packages are referenced in the project. This may be because the newly introduced library module has a jar package that is repeatedly referenced in the main project, android compatibility package needs to be checkedSupport-v4AndSupport-v7Package, and some common open-source projects, such as Gson, Nineoldandroids ..., These common open-source projects may have been referenced in the library project you have referenced.
Solution:
To solve this problem, we only need to delete the main projectLibsIn the folder and in the library, I recommend that you change the habit of placing the jar package in the libs directory and use Gradle to build it.Build. gradleUnder
dependencies { compile files('libs/nineoldandroids-2.4.0.jar')}
Or
dependencies { compile fileTree(dir: 'libs', include: ['*.jar'])}
Change
dependencies { compile 'com.nineoldandroids:library:2.4.0'}
In the reference Link, I found a similar exception
Error: Execution failed for task': app: dexdebug '.
> Com. android. ide. common. internal. LoggedErrorException
This error occurs because compile 'com. nineoldandroids: library: 2.4.0 ', but I simulated the main project and Library Project in the latest Android Studio 1.3 Preview and Gradle 2.3, but this exception did not occur, build is provided according to the problem. gradle file. This may be because Android Studio or Gradle is used in earlier versions. Therefore, you 'd better check the jar file already introduced in the library project in the project, the library should not be introduced into the main project.
Reference link:
Http://stackoverflow.com/questions/27675717/gradle-error-execution-failed-for-task-appdexdebug/27675841
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.