googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.38k stars 1.08k forks source link

Android build error after adding GoogleMobileAdsUnityAdsMediation.unitypackage #829

Closed nitzanwilnai closed 5 years ago

nitzanwilnai commented 5 years ago

I get the following build error after adding the unity ads mediation package.

Everything was running great before.

Ads are turned on and Enable Built-in Extension is turned off (although I get the same error regardless).

I have tried 2.0.1, 2.0.0 and 1.2.0 to no avail.

I also added Admob and the Mediation package to a brand new project and got the same error.

Can anyone offer any help?

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

stderr[ D8: Program type already present: com.unity3d.ads.UnityAds$PlacementState

FAILURE: Build failed with an exception.

BUILD FAILED in 9s ] stdout[ :checkReleaseClasspath :preBuild UP-TO-DATE :Firebase:preBuild UP-TO-DATE :Firebase:preReleaseBuild UP-TO-DATE :Firebase:checkReleaseManifest :Firebase:processReleaseManifest :GoogleMobileAdsPlugin:preBuild UP-TO-DATE :GoogleMobileAdsPlugin:preReleaseBuild UP-TO-DATE :GoogleMobileAdsPlugin:checkReleaseManifest :GoogleMobileAdsPlugin:processReleaseManifest :preReleaseBuild :Firebase:compileReleaseAidl NO-SOURCE :GoogleMobileAdsPlugin:compileReleaseAidl NO-SOURCE :compileReleaseAidl NO-SOURCE :Firebase:packageReleaseRenderscript NO-SOURCE :GoogleMobileAdsPlugin:packageReleaseRenderscript NO-SOURCE :compileReleaseRenderscript UP-TO-DATE :checkReleaseManifest UP-TO-DATE :generateReleaseBuildConfig UP-TO-DATE :prepareLintJar UP-TO-DATE :mainApkListPersistenceRelease UP-TO-DATE :generateReleaseResValues UP-TO-DATE :generateReleaseResources UP-TO-DATE :Firebase:compileReleaseRenderscript :Firebase:generateReleaseResValues :Firebase:generateReleaseResources :Firebase:packageReleaseResources :GoogleMobileAdsPlugin:compileReleaseRenderscript :GoogleMobileAdsPlugin:generateReleaseResValues :GoogleMobileAdsPlugin:generateReleaseResources :GoogleMobileAdsPlugin:packageReleaseResources :mergeReleaseResources UP-TO-DATE :createReleaseCompatibleScreenManifests UP-TO-DATE :processReleaseManifest :splitsDiscoveryTaskRelease UP-TO-DATE :Firebase:generateReleaseRFile :GoogleMobileAdsPlugin:generateReleaseRFile :processReleaseResources :generateReleaseSources :Firebase:generateReleaseBuildConfig :Firebase:prepareLintJar UP-TO-DATE :Firebase:generateReleaseSources :Firebase:javaPreCompileRelease :Firebase:compileReleaseJavaWithJavac :Firebase:processReleaseJavaRes NO-SOURCE :Firebase:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease :GoogleMobileAdsPlugin:generateReleaseBuildConfig :GoogleMobileAdsPlugin:prepareLintJar UP-TO-DATE :GoogleMobileAdsPlugin:generateReleaseSources :GoogleMobileAdsPlugin:javaPreCompileRelease :GoogleMobileAdsPlugin:compileReleaseJavaWithJavac :GoogleMobileAdsPlugin:processReleaseJavaRes NO-SOURCE :GoogleMobileAdsPlugin:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease :javaPreCompileRelease :compileReleaseJavaWithJavac :compileReleaseNdk NO-SOURCE :compileReleaseSources :lintVitalRelease :mergeReleaseShaders UP-TO-DATE :compileReleaseShaders UP-TO-DATE :generateReleaseAssets UP-TO-DATE :Firebase:mergeReleaseShaders :Firebase:compileReleaseShaders :Firebase:generateReleaseAssets :Firebase:packageReleaseAssets :GoogleMobileAdsPlugin:mergeReleaseShaders :GoogleMobileAdsPlugin:compileReleaseShaders :GoogleMobileAdsPlugin:generateReleaseAssets :GoogleMobileAdsPlugin:packageReleaseAssets :mergeReleaseAssets :transformClassesWithDexBuilderForRelease :transformDexArchiveWithExternalLibsDexMergerForRelease FAILED 49 actionable tasks: 36 executed, 13 up-to-date ] exit code: 1 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0) UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0) UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0) UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <e1c3953b4cf040ddb1400046b1c34897>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action1[T] progress) (at :0) Rethrow as GradleInvokationException: Gradle build failed UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at :0) UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

joshuajplagonera commented 5 years ago

Can you try turning OFF the Ads service? The UnityAds Mediation plugin is incompatible with the Ads Service.

charlesqu-thinkcube commented 5 years ago

Had Exact same problem and found this post. In Unity, go to Tools -> Package Manager, and Uninstall "Advertisement" Fixed the problem

UragayalaDeepika commented 5 years ago

@nitzanwilnai Please comment here if you are still having this issue. We will reopen this and will assist you further. Marking this as closed for now.