Error - Zip file app-debug.apk already contains entry 'classes.dex', cannot overwrite

1.8k Views Asked by At

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.

1

There are 1 best solutions below

2
Sebastian Hölzer On

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.