After updating Unity to version 5.6.3p2, I am getting an error when Unity is “Building Gradle Project” when trying to build an .apk for android platform.
This is what the console says;
CommandInvokationFailure: Gradle build failed.
C:/Program Files (x86)/Java/jdk1.8.0_131\bin\java.exe -classpath “C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar” org.gradle.launcher.GradleMain “assembleRelease”
stderr[
FAILURE: Build failed with an exception.
- What went wrong:
A problem occurred configuring root project ‘gradleOut’.
Cannot add task ‘:prepareUnityAdsLibrary’ as a task with that name already exists.
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]
stdout[
Incremental java compilation is an incubating feature.
BUILD FAILED
Total time: 26.887 secs
]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.Progress progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.HostView:OnGUI()
After updating, I was having trouble with Untiy Ads. I was getting compiler errors concerning the Header File Advertisements. Turns out that for some reason after updating, Unity Ads was turned off or not connected to my project and could not reference that header. So I tried to update though the asset store only to have more problems. Then I learned that the latest version of the Ads plug-in is automatically added with newer version of Unity and I didn’t need to download through the Asset store. In fact doing so causes conflicts. I deleted the plug-in I downloaded from the asset store and reloaded and reconnected Unity Ads through the services tab but the problem still persists.
What should I do to solve this issue ? Thanks In advance.