0
\$\begingroup\$

Hi I am trying to build my android game and hopefully publish it but I am trying to build it and this error keeps coming up.

Can someone please help explain what this is trying to tell me and how to resolve it!!!

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

stderr[

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':checkReleaseDuplicateClasses'.

    1 exception was raised by workers: java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.unity3d.ads.BuildConfig found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.IUnityAdsListener found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.UnityAds found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.UnityAds$FinishState found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.UnityAds$PlacementState found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.UnityAds$UnityAdsError found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.mediation.IUnityAdsExtendedListener found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.metadata.InAppPurchaseMetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.metadata.MediationMetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.metadata.MetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:) Duplicate class com.unity3d.ads.metadata.PlayerMetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)

    Go to the documentation to learn how to Fix dependency resolution errors.

  • 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 12s ] stdout[

Configure project : WARNING: The option setting 'android.bundle.enableUncompressedNativeLibs=false' is experimental and unsupported. The current default is 'true'.

Task :preBuild UP-TO-DATE Task :preReleaseBuild UP-TO-DATE Task :compileReleaseRenderscript NO-SOURCE Task :generateReleaseResValues UP-TO-DATE Task :generateReleaseResources UP-TO-DATE Task :mergeReleaseResources UP-TO-DATE Task :checkReleaseManifest UP-TO-DATE Task :createReleaseCompatibleScreenManifests UP-TO-DATE Task :mainApkListPersistenceRelease UP-TO-DATE Task :processReleaseManifest Task :bundleReleaseResources Task :mergeReleaseShaders UP-TO-DATE Task :compileReleaseShaders UP-TO-DATE Task :generateReleaseAssets UP-TO-DATE Task :mergeReleaseAssets Task :checkReleaseDuplicateClasses FAILED 12 actionable tasks: 4 executed, 8 up-to-date ] exit code: 1 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action1[T] progress) (at <81dc7eaf178e4aa281be7d46d785476c>: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 <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <81dc7eaf178e4aa281be7d46d785476c>:0) Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <81dc7eaf178e4aa281be7d46d785476c>:0) UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:288) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

Error that comes up

Build Settings

Other Notification after trying to build

\$\endgroup\$
  • \$\begingroup\$ Please always post your error messages as text, not images. With text, it's easily searchable, so other users dealing with similar issues can easily find your thread. It also makes your question more accessible to experts using screen readers or translators, who might have difficulty offering help from an image alone. \$\endgroup\$ – DMGregory Apr 19 at 13:32
  • \$\begingroup\$ I am sorry please see my edit. \$\endgroup\$ – Usmaan Mahmood Apr 19 at 13:41
  • \$\begingroup\$ This looks related to your previous question — somehow your project contains two copies or versions of the Unity Ads library. Try uninstalling and reinstalling all your packages, and deleting the Library folder in your Unity project for good measure. Check to see whether you've manually put a copy of any of the Unity Ads framework in your assets folder, and if so, delete it. \$\endgroup\$ – DMGregory Apr 19 at 13:45
  • \$\begingroup\$ Thanks there was an android plug in with unityads in my assets and a unityads in my packages, I deleted the android plugin and it successfully built. \$\endgroup\$ – Usmaan Mahmood Apr 19 at 13:52
  • \$\begingroup\$ Awesome! Can you detail that in an Answer below to help others with similar issues? \$\endgroup\$ – DMGregory Apr 19 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.