Android APK Build Failing "Execution failed for task ':launcher:checkReleaseDuplicateClasses'."

I’m trying to make an APK build but I’m getting the following errors:

FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:launcher:checkReleaseDuplicateClasses’.
1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (:androidx.core.core-1.0.0:) and classes.jar (:com.android.support.support-compat-26.1.0:)

…along with 330 other similar errors which I believe to be related. (I will leave the full error message in a comment below).

I’m not very knowledgeable about these sorts of issues so a dumbed-down solution would be appreciated.

I am seeing the exact same problem. From my research something is pulling in a non-AndroidX version of that class. The jetifier is supposed to fix those to all use AndroidX but for some reason it's not. But sorry, I have not solved it yet.

6 Answers

6

I’m having the same issue, I change the Gradle Properties to use Jettifier, change the AndroidManifest.xml but still nothing, would appreciate if someone can help T_T

EDIT

I fixed it by going to AssetsPlay Services ResolverAndroid ResolverDelete Resolved Libraries

This solved my problem, thank you!

with this the apk build successfully but the game wouldn't even open any thing that i might have been doing wrong??

It worked for me. Thanks bud

God bless you, dear friend. I can't avoid the feeling that without this answer I would be spending days for nothing...

This resolved my problem too. Thanks.

Same for me.
I’m using Firebase and Facebook sdk. Everything works perfect on ios but i cant build on android, the only way for it to build is if i completely delete the plugins folder, but then firebase won’t start of course.

Tried using every version of 2019.3 and 2019.4 on mac, same 498 duplicate classes errors everytime.

Also tried:

  • Deleting resolved libraries
  • Resolve / Force Resolve
  • Update version handler
  • disable patch mainTemplate.gradle
  • deleting the sdk 14 or something on firebase AndroidManifest
  • updating and downgrading all plugins (now they are all in their latest version)
  • deleting library
  • deleting the folder, creating a new one and transfering packages and assets folders into it
  • restarting computer
  • everything in every thread ever

:stuck_out_tongue:

hey, u found any solution?

Deleting libary worked for me thank you king!

i guess with the Lerp function you are never going to reach the target position, that is how the Lerp function works. That is why when it comes out of loop the position is set to exact target position.

I use Mediation for ad. And my solution was just remove the “Advertisement” package on Package Manager from “In Project” tab.

i have the same problem, did you find any other solution?

I’ve fixed that issue by deleting the playcore.arr file from the Assets/GooglePlayPlugins/com.google.play.core/Runtime/Plugins folder

Unfortunately this simply causes the game to crash upon attempting to open it. Yes it makes the error disappear. But creates a larger issue

https://answers.unity.com/questions/1711904/android-apk-build-failing-execution-failed-for-tas.html,I had the same duplicate classes error but not in the same files, for me it worked deleting one of those files:
androidx.core.core-1.0.0
or
com.android.support.support-compat-26.1.0

Yup, deleting the files that were mentioned as duplicates did the trick for me, too.

The reason I was getting this error was because I had Admob imported and Unity Ads package as well. I deleted Unity Advertisements package from package manager.

I still got this error, when I searched for one of the duplicate files, it was located in my assets folder and the library folder. I closed Unity, deleted Library Folder and then reopened Unity.

It took a long time to rebuild Library folder and after that the build was finally successful.

Hope this helps someone else out struggling with this issue.