2

I am fairly new at Android development and have been struggling to get a working build of an app I am working on.

I receive the following error after a build with Gradle:

:app:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

    com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$1.class

I (think) I narrowed the issue down to multiple libraries using the same 'support-v4' module, but I'm not sure. I can provide more details. Thank you.

silvef
  • 61
  • 1
  • 9

1 Answers1

0

I fixed this by deleting .jar files that were duplicates.

silvef
  • 61
  • 1
  • 9
  • I am facing same issue. Can you please explain solution in more detail? Which .jar file was duplicated and need to delete? – KTPatel Nov 01 '17 at 09:37
  • It's been quite a while since I've experienced the issue. That specific project was importing libraries in .jar files, which were deprecated. If you're importing jar files, I suggest compiling against maven instead. If not, checking your dependencies with the following command: `$ ./gradlew app:dependencies` Review any potential duplicates and remove them from your project then run `$ ./gradlew clean assemble` – silvef Nov 02 '17 at 19:17