Entry name 'classes.dex' collided
Asked Answered
A

3

91

While trying to Generate a signed APK I'm getting this error

Entry name 'classes.dex' collided

Can someone tell me how to solve it? I recently changed the default package name which was com.exmaple to my app's name. It builds correctly but gives this error while trying to generate a signed APK

My android studio version is 4.1.2

Axe answered 4/3, 2021 at 14:31 Comment(0)
F
250

You are probably facing this error because you already have a signed APK in your project's "release" folder. Please check for any existing APK and delete it, then try to generate once more.

Farahfarand answered 5/3, 2021 at 9:24 Comment(3)
I think this will go down in history as one of the most misleading error messages of all time. - Your solution works like a charm ;)Facula
this is the second time I am here, for different android studio versions, buld failed with the same message Entry name 'classes.dex' collided same cause app-release.apk is already in the release folderRhapsodic
I'm surprised they haven't fixed this yetFarahfarand
N
31

I had the same problem and here's how I solved it easily:

  1. Build -> Clean Project
  2. Build -> Generate Signed Bundle / APK..
Nephogram answered 7/5, 2021 at 18:31 Comment(0)
R
1

Add this code in build.gradle

android {
    packagingOptions {
    exclude 'classes.dex'
    exclude '**.**'
    }
}

https://rtdevs.xyz/how-to-solve-entry-name-classes-dex-collided-in-android-studio/

Rosalbarosalee answered 20/7, 2022 at 3:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.