Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Build Error with Unity Ads 3.0.1

Discussion in 'Unity Ads' started by AnnoyingGames, Feb 9, 2019.

  1. AnnoyingGames

    AnnoyingGames

    Joined:
    Nov 9, 2014
    Posts:
    19
    I'm getting a build error every time I try to build with the Unity Ads 3.0.1 plugin.

    I can build the game without the plugin just fine, it's only after I import it.

    Here's the error code.


    CommandInvokationFailure: Gradle build failed.
    /Applications/Unity/Hub/Editor/2018.3.5f1/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/MacOS/bin/java -classpath "/Applications/Unity/Hub/Editor/2018.3.5f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

    stderr[
    Note: there were 11 duplicate class definitions.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
    Warning: com.unity3d.ads.UnityAds$1: can't find referenced method 'void access$000(java.lang.String,com.unity3d.ads.UnityAds$UnityAdsError,java.lang.String)' in program class com.unity3d.ads.UnityAds
    Warning: com.unity3d.ads.UnityAds$2: can't find enclosing method 'void handleShowError(java.lang.String,com.unity3d.ads.UnityAds$UnityAdsError,java.lang.String)' in program class com.unity3d.ads.UnityAds
    Warning: there were 2 unresolved references to program class members.
    Your input classes appear to be inconsistent.
    You may need to recompile the code.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':transformClassesAndResourcesWithProguardForRelease'.
    > Job failed, see logs for details

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 7s
    ]
    stdout[
    :checkReleaseClasspath
    :preBuild UP-TO-DATE
    :extractProguardFiles UP-TO-DATE
    :GooglePlayGamesManifest.plugin:preBuild UP-TO-DATE
    :GooglePlayGamesManifest.plugin:preReleaseBuild UP-TO-DATE
    :GooglePlayGamesManifest.plugin:checkReleaseManifest
    :GooglePlayGamesManifest.plugin:processReleaseManifest
    :preReleaseBuild
    :GooglePlayGamesManifest.plugin:compileReleaseAidl NO-SOURCE
    :compileReleaseAidl NO-SOURCE
    :GooglePlayGamesManifest.plugin:packageReleaseRenderscript NO-SOURCE
    :compileReleaseRenderscript
    :checkReleaseManifest UP-TO-DATE
    :generateReleaseBuildConfig UP-TO-DATE
    :prepareLintJar UP-TO-DATE
    :mainApkListPersistenceRelease UP-TO-DATE
    :generateReleaseResValues UP-TO-DATE
    :generateReleaseResources
    :GooglePlayGamesManifest.plugin:compileReleaseRenderscript
    :GooglePlayGamesManifest.plugin:generateReleaseResValues
    :GooglePlayGamesManifest.plugin:generateReleaseResources
    :GooglePlayGamesManifest.plugin:packageReleaseResources
    :mergeReleaseResources
    :createReleaseCompatibleScreenManifests UP-TO-DATE
    :processReleaseManifest
    :splitsDiscoveryTaskRelease UP-TO-DATE
    :GooglePlayGamesManifest.plugin:generateReleaseRFile
    :processReleaseResources
    :generateReleaseSources
    :GooglePlayGamesManifest.plugin:generateReleaseBuildConfig
    :GooglePlayGamesManifest.plugin:prepareLintJar
    :GooglePlayGamesManifest.plugin:generateReleaseSources
    :GooglePlayGamesManifest.plugin:javaPreCompileRelease
    :GooglePlayGamesManifest.plugin:compileReleaseJavaWithJavac
    :GooglePlayGamesManifest.plugin:processReleaseJavaRes NO-SOURCE
    :GooglePlayGamesManifest.plugin:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
    :javaPreCompileRelease
    :compileReleaseJavaWithJavac
    :compileReleaseNdk NO-SOURCE
    :compileReleaseSources
    :lintVitalRelease
    :mergeReleaseShaders UP-TO-DATE
    :compileReleaseShaders UP-TO-DATE
    :generateReleaseAssets UP-TO-DATE
    :GooglePlayGamesManifest.plugin:mergeReleaseShaders
    :GooglePlayGamesManifest.plugin:compileReleaseShaders
    :GooglePlayGamesManifest.plugin:generateReleaseAssets
    :GooglePlayGamesManifest.plugin:packageReleaseAssets
    :mergeReleaseAssets
    :checkReleaseLibraries UP-TO-DATE
    :processReleaseJavaRes NO-SOURCE
    :transformResourcesWithMergeJavaResForRelease
    :GooglePlayGamesManifest.plugin:mergeReleaseConsumerProguardFiles
    :transformClassesAndResourcesWithProguardForRelease
    ProGuard, version 6.0.3
    Reading input...
    Reading program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/libs/unity-classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/libs/android.arch.lifecycle.common-1.0.0.jar] (filtered)
    Reading program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/libs/android.arch.core.common-1.0.0.jar] (filtered)
    Reading program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/libs/com.android.support.support-annotations-26.1.0.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/GoogleAIDL.aar/6efa0a4464783c20d2af049f61e5bb79/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/GooglePlay.aar/0613ad1d032105fbd1f2f81f45a9164d/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/UnityAds.aar/d4ac8c7f02924fa6ef48f47043ccee7d/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/android.arch.lifecycle.runtime-1.0.0.aar/1113c7e91caa4e918d8092a4cd7179a5/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-compat-26.1.0.aar/5f8dc87f88646f55c3685cbb850b57a2/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-core-ui-26.1.0.aar/2df868af4e28369f27f16aa6f23a9d1d/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-core-utils-26.1.0.aar/d42742aa8ca2a432b1dade92122aff2e/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-fragment-26.1.0.aar/4b3715e99ad2848ab20389cd7757f191/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-media-compat-26.1.0.aar/a4fb624e6d01c9346bd38a8eb46cb43b/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-v4-26.1.0.aar/988cc9f9049bbaca30c8cc8ae97101c7/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-auth-16.0.1.aar/e39e751113723031840c1f072b9df082/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-auth-api-phone-16.0.0.aar/3f5525d8f67dddb38e4410d0a0db8e6f/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-auth-base-16.0.0.aar/c558e51aa3a51595b6945de1687c6058/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-base-16.0.1.aar/c4f657193540d68863c039020a23bff5/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-basement-16.0.1.aar/2bcd7c2fd49937fd1cb5df321c017bac/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-drive-16.0.0.aar/528fe61652ffb580199ba4329ea28761/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-games-16.0.0.aar/4b14abb22938c9e21dc4d0c815d4a612/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-nearby-16.0.0.aar/9d252444e62889b59619b969ae481846/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.android.gms.play-services-tasks-16.0.1.aar/3f6740f8f7584c89e995efc43bf2dfda/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.google.games.gpgs-plugin-support-0.9.60.aar/6c47add10cc81e7d357a57be8e2db2b9/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/common.aar/8711a3b0d36455e10d8b55a816294f26/jars/classes.jar] (filtered)
    Reading program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/unity-ads.aar/462c01cc884c55804766b1c7b74d40bf/jars/classes.jar] (filtered)
    Note: duplicate definition of program class [com.unity3d.ads.IUnityAdsListener]
    Note: duplicate definition of program class [com.unity3d.ads.UnityAds$FinishState]
    Note: duplicate definition of program class [com.unity3d.ads.UnityAds$PlacementState]
    Note: duplicate definition of program class [com.unity3d.ads.UnityAds$UnityAdsError]
    Note: duplicate definition of program class [com.unity3d.ads.UnityAds]
    Note: duplicate definition of program class [com.unity3d.ads.mediation.IUnityAdsExtendedListener]
    Note: duplicate definition of program class [com.unity3d.ads.metadata.InAppPurchaseMetaData]
    Note: duplicate definition of program class [com.unity3d.ads.metadata.MetaData]
    Note: duplicate definition of program class [com.unity3d.ads.metadata.MediationMetaData]
    Note: duplicate definition of program class [com.unity3d.ads.metadata.PlayerMetaData]
    Note: duplicate definition of program class [com.unity3d.ads.BuildConfig]
    Reading program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/GooglePlayGamesManifest.plugin/build/intermediates/intermediate-jars/release/classes.jar] (filtered)
    Reading program directory [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes] (filtered)
    Reading program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/build/intermediates/transforms/mergeJavaRes/release/0.jar] (filtered)
    Reading library jar [/Users/andrewhashman/Library/Android/sdk/platforms/android-28/android.jar]
    Reading library jar [/Users/andrewhashman/Library/Android/sdk/build-tools/28.0.3/core-lambda-stubs.jar]
    Reading library jar [/Users/andrewhashman/Library/Android/sdk/platforms/android-28/optional/org.apache.http.legacy.jar]
    Reading library jar [/Users/andrewhashman/Library/Android/sdk/platforms/android-28/optional/android.test.mock.jar]
    Reading library jar [/Users/andrewhashman/Library/Android/sdk/platforms/android-28/optional/android.test.base.jar]
    Reading library jar [/Users/andrewhashman/Library/Android/sdk/platforms/android-28/optional/android.test.runner.jar]
    Initializing...
    Note: the configuration refers to the unknown class 'com.google.android.gms.common.api.internal.BasePendingResult$ReleasableResultGuardian'
    Note: com.google.android.gms.common.util.WorkSourceUtil: can't find dynamically referenced class android.os.WorkSource$WorkChain
    Note: com.unity.purchasing.googleplay.GooglePlayPurchasing: can't find dynamically referenced class com.google.vr.ndk.base.DaydreamApi
    Note: com.unity3d.services.ar.ARCheck: can't find dynamically referenced class com.google.ar.core.Session
    Note: the configuration refers to the unknown field 'com.google.android.gms.common.api.internal.BasePendingResult$ReleasableResultGuardian mResultGuardian' in class 'com.google.android.gms.common.api.internal.BasePendingResult'
    Note: the configuration keeps the entry point 'com.google.android.gms.common.api.internal.LifecycleCallback { com.google.android.gms.common.api.internal.LifecycleFragment getChimeraLifecycleFragmentImpl(com.google.android.gms.common.api.internal.LifecycleActivity); }', but not the descriptor class 'com.google.android.gms.common.api.internal.LifecycleActivity'
    Note: the configuration explicitly specifies 'android.webkit.JavascriptInterface' to keep library class 'android.webkit.JavascriptInterface'
    Note: the configuration explicitly specifies 'android.webkit.JavascriptInterface' to keep library class 'android.webkit.JavascriptInterface'
    Note: there were 1 references to unknown classes.
    You should check your configuration for typos.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
    Note: there were 1 references to unknown class members.
    You should check your configuration for typos.
    Note: there were 1 unkept descriptor classes in kept class members.
    You should consider explicitly keeping the mentioned classes
    (using '-keep').
    (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
    Note: there were 2 library classes explicitly being kept.
    You don't need to keep library classes; they are already left unchanged.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#libraryclass)
    Note: there were 3 unresolved dynamic references to classes or interfaces.
    You should check if you need to specify additional program jars.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
    Note: you're ignoring all warnings!
    Ignoring unused library classes...
    Original number of library classes: 4803
    Final number of library classes: 1329
    Printing kept classes, fields, and methods...
    Inlining subroutines...
    Shrinking...
    Printing usage to [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/build/outputs/mapping/release/usage.txt]...
    Removing unused program classes and class elements...
    Original number of program classes: 4210
    Final number of program classes: 1315
    Obfuscating...
    Printing mapping to [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/build/outputs/mapping/release/mapping.txt]...
    Preverifying...
    Writing output...
    Preparing output jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/build/intermediates/transforms/proguard/release/0.jar]
    Copying resources from program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/libs/unity-classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/libs/android.arch.lifecycle.common-1.0.0.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/libs/android.arch.core.common-1.0.0.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/Desktop/2D Space Shooter/Temp/gradleOut/libs/com.android.support.support-annotations-26.1.0.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/GoogleAIDL.aar/6efa0a4464783c20d2af049f61e5bb79/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/GooglePlay.aar/0613ad1d032105fbd1f2f81f45a9164d/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/UnityAds.aar/d4ac8c7f02924fa6ef48f47043ccee7d/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/android.arch.lifecycle.runtime-1.0.0.aar/1113c7e91caa4e918d8092a4cd7179a5/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-compat-26.1.0.aar/5f8dc87f88646f55c3685cbb850b57a2/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-core-ui-26.1.0.aar/2df868af4e28369f27f16aa6f23a9d1d/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-core-utils-26.1.0.aar/d42742aa8ca2a432b1dade92122aff2e/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-fragment-26.1.0.aar/4b3715e99ad2848ab20389cd7757f191/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.support.support-media-compat-26.1.0.aar/a4fb624e6d01c9346bd38a8eb46cb43b/jars/classes.jar] (filtered)
    Copying resources from program jar [/Users/andrewhashman/.gradle/caches/transforms-1/files-1.1/com.android.supp<message truncated>


    I see where it says I have duplicates but I searched within the editor and found no such thing, if anyone could help me with this that'd be great!

    I tried using Google Mobile Ads for Unity and that was just a crap shoot, and I didn't realize until now that Unity had an ad service.
     
  2. sbankhead

    sbankhead

    Unity Technologies

    Joined:
    Jul 27, 2014
    Posts:
    2
    It looks like you have more than one definition of the Unity Ads code base. How are you getting Unity Ads 3.0.1 into your project, is it via the Asset Store or Unity Package Manager? Are you using mediation in the same project, as the mediation code would also include a copy of the Unity Ads Framework bundled with it. At the end of the day, you can only have one definition of the Unity Ads Framework in your code base or you will run into issues with duplicate class definitions.

    If you don't believe the above is happening in your project, or are confident your only including the SDK once, would you be able to share your project or a simple repro project with us so that we can investigate the issue further? If not, some clearer steps on how this can be reproduced from a new project would greatly help us in tracking down this error and getting things fixed for you and others going forward.
     
  3. AnnoyingGames

    AnnoyingGames

    Joined:
    Nov 9, 2014
    Posts:
    19
    I imported the one directly from the Unity Asset Store, I also had imported the Unity IAP, I'm not sure if they have conflicts within both of those packages, I just always assumed that I needed to import Unity IAP before the Unity Ads.
     
  4. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    64
    @AnnoyingGames
    Are you using ProGuard? This is a wild guess... If you have imported Mediation before, could be that your ProGuard file is trying to link not existing files. I would advise you to check ProGuard file or disable it.
     
    Last edited: Feb 12, 2019
  5. AnnoyingGames

    AnnoyingGames

    Joined:
    Nov 9, 2014
    Posts:
    19
    I think I am using Proguard for that project. What do I look for when I open it?
     
  6. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    64
    Please, try to disable it in Build Settings. In order to isolate the issue.