9

When building my Android app with Android-Studio in debug, it works, but when building in release mode, I get the following error at the :app:bundleReleaseClasses step:

Zip file app/build/intermediates/app_classes/release/classes.jar' already contains entry 'META-INF/MANIFEST.MF', cannot overwrite

Building in CLI with ./gradlew assembleDebug (or even ./gradlew bundleReleaseClasses) works.

What could be the reason for this error in Android-Studio, knowing that it works in gradle CLI? I tried excluding this file in packagingOptions {}, but it does not seem to have any effect.

I tried this, this, this, this and a few other related questions, but did not find an answer.

Note that it fails with AGP 7.0.0, 7.0.1, 7.0.2, 7.0.3 and 7.0.4. Not sure if I should try going further back.

JonasVautherin
  • 7,297
  • 6
  • 49
  • 95
  • Did you manage to resolve this issue ? – Tendai Oct 11 '22 at 07:00
  • It disappeared, I could not identify what changed. Some update of some subcomponent probably, as mentioned by the answer below. I would just try to update the gradle plugin, gradle, and Android Studio. – JonasVautherin Oct 11 '22 at 12:58

2 Answers2

0

I was getting the same error in debug build, and I fixed it by deleting Build folder.

already contains entry 'META-INF/xxxxxx_debug.kotlin_module', cannot overwrite
  1. Go to project view -> Build (delete this folder)
  2. Rebuild (Build -> Rebuild Project)
Arpit Patel
  • 7,212
  • 5
  • 56
  • 67
-2

Just Update your Gradle plugin version version

I had the same error in Android Studio Chipmunk| 2021.2.1 and Gradle version 7.1.2 and after updating Gradle plugin version to 7.2.0 this problem is resolved.

  • 1
    I would like to have answer analyzing the root cause and then suggesting a solution. This sort of an answer is not helpful. – Ivan Angelov Sep 20 '22 at 07:28