Skip to main content

Unity ads duplicates

Unity: All versions | Appodeal SDK: All versions


The error Duplicate class com.unity3d.ads during the build occurs if there are Unity ads duplicates in the project. Appodeal SDK contains the Unity ads adapter. Meanwhile, sometimes Unity ads network may be enabled by default in Unity. Using Appodeal SDK along with native Unity ads network will cause duplicates errors.

The error log example from Unity Editor Log:

stderr[

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 com.unity3d.ads.BuildConfig found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
Duplicate class com.unity3d.ads.IUnityAdsInitializationListener found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
Duplicate class com.unity3d.ads.IUnityAdsListener found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
Duplicate class com.unity3d.ads.IUnityAdsLoadListener found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
Duplicate class com.unity3d.ads.IUnityAdsShowListener found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
Duplicate class com.unity3d.ads.UnityAds found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
Duplicate class com.unity3d.ads.UnityAds$1 found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
Duplicate class com.unity3d.ads.UnityAds$FinishState found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
Duplicate class com.unity3d.ads.UnityAds$PlacementState found in modules jetified-UnityAds-runtime.jar (:UnityAds:) and jetified-unity-ads-3.7.2-runtime.jar (com.unity3d.ads:unity-ads:3.7.2)
...

To fix it:

  1. Go to Window → Package Manager and remove Advertisement package.
  1. Go to Assets → External Dependency Manager → Android Resolver and press Resolve or Force Resolve.

  2. Rebuild the project.