- Home /
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.
There's a character count limit so here's what I can put:
CommandInvokationFailure: Gradle build failed. /Applications/Unity/Hub/Editor/2019.3.7f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2019.3.7f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.Gradle$$anonymous$$ain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
1 exception was raised by workers:
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.
Answer by _uso212 · Dec 23, 2020 at 12:40 AM
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 Assets > Play Services Resolver > Android Resolver > Delete Resolved Libraries.
with this the apk build successfully but the game wouldn't even open any thing that i might have been doing wrong??
It happened to me as well. But that was due to Facebook SDK not being implemented correctly (I had to switch to a different version). You could check your crash log to see what exactly made your application crash on start.
God bless you, dear friend. I can't avoid the feeling that without this answer I would be spending days for nothing...
Thank you, really saved me, I was struggling with this over a day
Are you sure it fixed it because by deleting the libraries it's likely something will not work although you might not realize it unless you look at the console while running the app. It certainly didn't solve it for Firebase + Vuforia as all the Firebase functions failed. I had to report it to Vuforia and they released an update which fixed the issue.
yes it helped me to get an debuggable apk, the reason of my issue was Facebook sdk, no firebase or Vuforia
Answer by ffdev78 · Aug 09, 2021 at 10:19 AM
I've fixed that issue by deleting the playcore.arr file from the Assets/GooglePlayPlugins/com.google.play.core/Runtime/Plugins folder
Answer by Elizeu159 · Jul 22, 2020 at 08:55 PM
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
:P
Answer by ertbaran · May 21 at 05:20 AM
I use Mediation for ad. And my solution was just remove the "Advertisement" package on Package Manager from "In Project" tab.