0

I imported a jar file in app/libs dir and added it as a library in build.gradle file. But when I am building the project getting errors -

Zip file 'E:\AndroidProjects\testing\app\build\intermediates\apk\debug\app-debug.apk' already contains entry 'classes.dex', cannot overwrite

Note - This jar file is created in another environment/ having a different signature.

implementation files('libs/myjar.jar')

This issue looks like this and this - and I have tried deleting/ cleaning the build folder but this error is not going away. I also tried changing the Gradle version to the latest 7.2.1.

Bajrang Hudda
  • 3,028
  • 1
  • 36
  • 63

1 Answers1

-1

I had this error too. In my case i tried to add a jar file to my app containing a classes.dex file. I could avoid that error by adding the lib compiled to java byte code rather than dex bytecode.

  • 1
    Well, in my case I can't control this behavior. Because this jar is created by some 3rd party people. I am not sure if a .jar file can also have java byte code and dex bytecode differently. – Bajrang Hudda Jul 27 '22 at 11:38
  • you could try to decompile the dex file back to java byte code like in the answer to this question https://stackoverflow.com/questions/1249973/decompiling-dex-into-java-sourcecode – Sebastian Hölzer Aug 02 '22 at 11:20