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’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
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
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.