Дубликаты Unity ads
Unity: Все версии | Appodeal SDK: Все версии
Ошибка Duplicate class com.unity3d.ads
во время сборки возникает,
если в проекте есть дубликаты рекламной сети Unity Ads. Appodeal SDK
содержит адаптер Unity Ads. Между тем, иногда рекламная сеть Unity может
быть включена в Unity по умолчанию, что может привести к ошибкам
дубликатов файлов.
Пример ошибки из 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)
...
Для устранения ошибки:
- Перейдите в Window → Package Manager и удалите пакет Advertisement.
Перейдите в Assets → External Dependency Manager → Android Resolver и нажмите Resolve или Force Resolve.
Пересоберите проект.