1 exception was raised by workers: See the Console for details.

Hi, I work in Unity 2018.4.16f1 (64-bit). Today I had to build my project in Grudle, but there is a problem. Help me as soon as possible. Please do not write much, but to understand, you can write a solution step by step.

1 exception was raised by workers: See the Console for details.

CommandInvokationFailure: Gradle build failed. D:\Новая папка\2018.4.16f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath “D:\Новая папка\2018.4.16f1\Editor\Data\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.

1 exception was raised by workers:

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 3m 29s ] stdout[

Configure project :

WARNING: The option setting ‘android.bundle.enableUncompressedNativeLibs=false’ is experimental and unsupported. The current default is ‘true’. Observed package id ‘build-tools;26.0.0-rc2’ in inconsistent location ‘D:\SDK\SDK\build-tools\26.0.0-preview’ (Expected ‘D:\SDK\SDK\build-tools\26.0.0-rc2’)
Task :preBuild UP-TO-DATE Task :preReleaseBuild Task :compileReleaseRenderscript NO-SOURCE Task :generateReleaseResValues Task :generateReleaseResources Task :mergeReleaseResources Task :checkReleaseManifest Task :createReleaseCompatibleScreenManifests Task :mainApkListPersistenceRelease Task :processReleaseManifest Task :bundleReleaseResources Task :mergeReleaseShaders Task :compileReleaseShaders Task :generateReleaseAssets Task :mergeReleaseAssets Task :checkReleaseDuplicateClasses FAILED

12 actionable tasks: 12 executed ] 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 :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) 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 :0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :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 :0) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at :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 C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:288) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179) Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e) Copyright (C) Microsoft Corporation. All rights reserved.

@kozakoleg284 Your problem is conflicting dublicate classes from UnityAds plugin. It seems you are importing it twice:

  1. The first one shood be at the path Packages/com.unity.ads/Editor.Resources/Android/builds/unity-ads.aar
  2. And the second one is :UnityAds (try to find it and remove). Maybe you have imported it with some mediation stuff.