23

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
  • 231
  • 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

9 Answers9

52

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
  • 521
  • 2
  • 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
19

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
  • 191
  • 1
  • 2
4
  • 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

Codemaker
  • 7,952
  • 3
  • 61
  • 53
4

Use in the below steps will working perfectly.

Menu -> Build -> Clean project

that's all. Enjoy your coding.

mahendren
  • 988
  • 9
  • 8
4

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

developer
  • 105
  • 1
  • 10
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
  • 168
  • 2
  • 13
2

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

Shaon
  • 2,010
  • 19
  • 22
2

In my case , I deleted the debug and release directory

mikail yusuf
  • 119
  • 3
  • 4
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
  • 168
  • 2
  • 6