Reputation: 562
If Unity Ads is removed, the project can be successfully built. But once Unity Ads is added through Packages tab, it will have the error as below:
Execution failed for task ':checkReleaseDuplicateClasses'.
java.lang.RuntimeException: Duplicate class com.unity3d.ads.BuildConfig found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
...
Duplicate class com.unity3d.ads.metadata.PlayerMetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
How will the other Unity Ads be removed so that it will retain only the package version? Thanks in advance.
Upvotes: 2
Views: 13380
Reputation: 21
I have been trying to solve this problem for 3 days and I finally made it. Maybe this will save another person's life too.
In the folder projects/yourProject/Assets/Editor, I deleted MediationAdapterDependencies.xml and MediationAdapterDependencies.xml.meta and that's it!
So, one of the duplicates is now gone Unity advertisements can work with the package manager -> Advertisement Legacy. I don't know when I downloaded the mediation, maybe it is coming with Unity automatically but this is the way to remove it. If you want to use the mediation then remove the package manager one.
Upvotes: 1
Reputation: 1
Here is the solution: I had installed Advertisement through package manager first of all I did this Assets -> External Dependency Manager -> Android Resolver -> Delete Resolved Libraries. Then I removed Advertisement from package manager and installed it again.
Upvotes: 0
Reputation: 515
If you have previously installed the Mediation ads plugin (which I removed due to not being able to control the ad volume level that I could see) I was getting this when I changed to use Unity Ads. I had to delete the contents of the Assets\Editor folder in my project (MediationAdapterDependencies.xml) as it seemed to be confusing the gradle build.
Upvotes: 6
Reputation: 71
I just encountered and fixed this problem with my game.
There are 2 packages: Unity Ads 2.0.8 and Unity Advertisement 3.4.5 I think I downloaded Unity Ads from the asset store and (maybe) Unity Advertisement was installed when I activated Unity Ads from Services (in the Unity editor).
You want to be using Unity Advertisement since Ads has been deprecated.
Here's what I did:
1) Removed the Unity Ads package (Window > Package Manager > Advertisement). Mine was 2.0.8
2) From the Project Window: Assets > delete the UnityAds folder
3) Also delete Assets > Plugins > iOS > delete UnityAds.framework
4) Reinstall Unity Advertisement 3.4.5
Step #1 may not be necessary for you but it's what I did.
Upvotes: 2
Reputation: 753
I had same issue as you have, you should uncheck enable built-in extension for Unity Ads. I think you added Unity ads sdk manually and checked built-in extension.
Upvotes: 10