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.

Álvaro Sánchez
  • 241
  • 1
  • 2
  • 3
  • Does this answer your question? [Android Studio 0.4 Duplicate files copied in APK META-INF/LICENSE.txt](https://stackoverflow.com/questions/20827885/android-studio-0-4-duplicate-files-copied-in-apk-meta-inf-license-txt) Try to use `exclude "META-INF/androidx.vectordrawable**"` – Nicolas Jun 09 '20 at 23:47

10 Answers10

55

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.

Yam
  • 551
  • 3
  • 4
  • 8
    Clear the build using Menu -> Build -> Clean project, and it worked. – Malay M Aug 17 '20 at 10:17
  • For some weird reason I had to 'Clean Project' twice before it worked. – King Of The Jungle Oct 20 '20 at 16:43
  • Menu -> Build -> Clean project, worked for me. Thanks – Ornelio Chauque Oct 27 '20 at 17:30
  • 1
    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). – Samuel T. Chou Dec 22 '20 at 09:41
  • `Build > Rebuild Project` helped me with `Entry name 'META-INF/androidx.preference_preference.version' collided` error. – CoolMind Mar 23 '21 at 13:42
  • Also you can try use something like that at your build.gradle(:app) : ``` applicationVariants.all { variant -> variant.outputs.all { outputFileName = "../../(" + System.currentTimeMillis() + ")" + outputFileName } } ``` – GSD.Aaz Jul 23 '21 at 15:12
22

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.

tmt
  • 321
  • 2
  • 3
7

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

developer
  • 135
  • 1
  • 2
  • 11
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

Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
5

Use in the below steps will working perfectly.

Menu -> Build -> Clean project

that's all. Enjoy your coding.

Mahendren Mahisha
  • 1,072
  • 11
  • 9
2

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

Check this for more

Mahmood Hussain
  • 423
  • 5
  • 14
2

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

Shaon
  • 2,496
  • 26
  • 27
2

In my case , I deleted the debug and release directory

mikail yusuf
  • 197
  • 3
  • 5
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
    }
}

GSD.Aaz
  • 178
  • 2
  • 6
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.

  • 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](/help/how-to-answer). – Community Sep 02 '22 at 06:48