Problem "Entry name 'META-INF...' collide - Android
Asked Answered
C

10

24

I have added some things to my mobile application, such as adds or animation-lists. The thing is that I could generate APKs perfectly some days ago and, since the moment y added those things, Android Studio does not let me generate them. It has the following error.

Entry name 'META-INF/androidx.vectordrawable_vectordrawable.version' collided

Or these other ones:

Execution failed for task ':app:packageDebug'. A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Entry name 'META-INF/androidx.vectordrawable_vectordrawable.version' collided

I have no idea what could get wrong. Thank you so much.

Conjunction answered 9/6, 2020 at 10:48 Comment(1)
Does this answer your question? Android Studio 0.4 Duplicate files copied in APK META-INF/LICENSE.txt Try to use exclude "META-INF/androidx.vectordrawable**"Flywheel
L
56

I had the similar problem with "META-INF/androidx.gridlayout_gridlayout.version' collided". It took my 4 hours and finally i resolved it. Method which worked for me i am not sure that will for you too but you can try. go to Menu Build > Rebuild Project thats it.

Lockett answered 7/7, 2020 at 16:16 Comment(6)
Clear the build using Menu -> Build -> Clean project, and it worked.Modish
For some weird reason I had to 'Clean Project' twice before it worked.Cleistogamy
Menu -> Build -> Clean project, worked for me. ThanksFelid
Though I feel this will work in most situation, this did not really solve mine. @tmt 's answer worked: remove/rename the already-generated apk (and json).Carlottacarlovingian
Build > Rebuild Project helped me with Entry name 'META-INF/androidx.preference_preference.version' collided error.Morie
Also you can try use something like that at your build.gradle(:app) : ``` applicationVariants.all { variant -> variant.outputs.all { outputFileName = "../../(" + System.currentTimeMillis() + ")" + outputFileName } } ```Prichard
S
21

In my case in the output directory there has already been a file called app-debug.apk and for whatever reason the android sdk could not overwrite it. The apk has been generated as soon as I deleted or renamed the old version.

Santo answered 30/10, 2020 at 11:0 Comment(3)
Thanks for this answer!! this solved my problem too.Settee
this should be marked as the answer, brilliant, thank you!Mathematical
See similar error and possible solutionsPrichard
D
7

Delete the previous APK you build and try again. it helps me to solve this issue.

Douche answered 1/2, 2021 at 8:1 Comment(0)
M
5
  • Click on Build -> Clean Project
  • Click on File -> Invalidate Caches / Restart

Still you have the same error then delete debug and release folder from the app folder then restart the IDE

Millisecond answered 24/9, 2020 at 7:51 Comment(0)
S
5

Use in the below steps will working perfectly.

Menu -> Build -> Clean project

that's all. Enjoy your coding.

Smallscale answered 30/9, 2020 at 10:18 Comment(0)
T
2

I had the same problem with my project Clean Project, as well as Rebuild Project, which worked for me.

Check this for more

Truffle answered 14/9, 2020 at 15:11 Comment(0)
B
2

In my case, I just rebuild the project. solved my problem

Boothe answered 29/11, 2020 at 4:42 Comment(0)
P
2

In my case , I deleted the debug and release directory

Palatalized answered 23/7, 2021 at 9:53 Comment(0)
P
0


Solution Clean Project works, but it is not useful do clean every time before Run.
So I created the the issue. And at issue' comments I got link to another issue, then I got solution, which works for me.

My project has the following lines at build.gradle(:app) specially for TeamCity

applicationVariants.all { variant ->
    variant.outputs.all {
        outputFileName = "../../" + outputFileName
    }
}

But it crash local build process.

So I just add condition and fix the issue!

applicationVariants.all { variant ->
    variant.outputs.all {
        if (rootProject.hasProperty("teamcity"))
            outputFileName = "../../" + outputFileName
    }
}

Prichard answered 23/7, 2021 at 15:11 Comment(0)
C
0

sometimes cleaning and rebuilding the project is enough to resolve the issue but if not you can delete a previously generated debug apk from a project folder. generally, it happens when you create a building project first time after switching the branch or getting the latest changes from git, or changing the build variant.

Chemesh answered 29/8, 2022 at 9:25 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Melanie

© 2022 - 2024 — McMap. All rights reserved.