Delete duplicate libraries.
Although the OP did not record this, if you look at the comments on the original question, you will see that they have several .jar library .jar in the libs directory, which are included in the following line:
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) //... }
In one of their comments, they list the following files in the libs directory:
google-http-client-1.19.0.jargoogle-http-client-android-1.19.0.jargoogle-http-client-gson-1.19.0.jargoogle-http-client-jackson2-1.19.0.jargson-2.1.jarguava-18.0.jarjackson-core-2.1.3.jarjava-api-core-2.10.1.jar Duplicate!java-api-core-2.10.5.jar Duplicate!kinvey-android-2.10.5.aar
You can clearly see that java-api-core enabled twice, once for version 2.10.1 and once for version 2.10.5 . The build system is not smart enough to cite just one of them, and it shouldn't be. The user must tell the build system which libraries should be included, and which version of each to include.
By java-api-core-2.10.1.jar from the libs directory, the error should be fixed.
This may not be the problem you are facing, but probably the result of something like that.
To avoid these situations, consider a few best practices:
1. Do not use compile fileTree...
Instead of hiding all the .jar files that you include, explicitly specify which files you are compiling into dependencies {} . This will make viewing easier when you have duplicates, conflicts, and other similar problems.
2. Use Maven instead of .jar files as much as possible.
Although he would not catch this using Maven and adding the same dependency with different versions twice, he should allow only one of these dependencies (I think) and avoid a cryptic error, as you can see.
source share