- Home /
Failed to build project with Unity Monetization SDK
Hello, I have trouble to build the Android and iOS project after I integrated Unity Monetization SDK. I followed Unity Ads tutorial and imported "Unity Monetization 3.0" from Unity Asset Store. And now I getting the following error when I am trying to build the Android project.
* What went wrong:
Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/0.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/1.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/2.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/3.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/4.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/5.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/6.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/7.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/8.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/9.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/10.jar, /Users/verusoft/Unity/ProjectName/BUILD/Android/Game Name/build/intermediates/transforms/dexBuilder/debug/11.jar
Program type already present: com.unity3d.ads.mediation.IUnityAdsExtendedListener
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
I tried both Unity 2018.3.2f1 and Unity 2018.3.3f1 but without success. Can anybody help me?
Answer by Verusoft · Jan 28, 2019 at 11:09 AM
I found the solution. When I checked generated Android project I noticed two unity ads libraries unity-ads.aar
and UnityAds.aar
. First one was added by Unity Services and the second one was added by the asset store package. So I disabled the Unity Ads support in Unity Services and now it works.
I'm wondering, does this still show up in the unity control panel? Do the ads still make revenue?
Yes they do..
It will still show the ads when your project is on Google Play.
The ads will generate money.
The Ads system will work perfectly with no issues.
This worked!!! And the ads still work! Thanks so much!!!
Sorry iam a beginner so, i can't understand your solution please someone explain ?