Im just gonna post it here, because i posted it in a wrong section,
so i recently couldnt get Unity to build my games, thats fixed.
But whenever i enable the ADS service, im getting an error at Gradle Build Failed.
This is the full error log:
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_151\bin\java.exe -classpath “C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx2048m” “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.
BUILD FAILED in 1s
]
stdout[
NDK is missing a “platforms” directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\lucst\Documents\Android SDK\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1 progress, System.String error) UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action
1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
As you can see, theres an error saying:
Cannot add task ‘:prepareUnityAdsLibrary’ as a task with that name already exists.
How can one fix this?
Its pretty frustrating haha
Thanks for any help!
It says you’re missing NDK Install it
Well, i pointed NDK to the right place in Preferences…
But i still get this:
EDIT: I added the NDK to the Path
and now theres no STDOUT
The ‘What went wrong’ part is still the same?
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_151\bin\java.exe -classpath “C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx2048m” “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.
BUILD FAILED in 1s
]
stdout[
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1 progress, System.String error) UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action
1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
So i thought, being smart, i make a new folder inside Android SDK\ and name it ndk-bundle, because its standard searching in it, but no… It still keeps giving the same error, then what i did is create a ANDROID_NDK_HOME variable and add the same folder to it, still the same error…
Just found out, that when i build with Enable built-in Ads extension
enabled, it generates the error above,
but when i disable it, i can build… Ads dont show up though…
(PS: Yes, i also have the asset store’s Unity Ads package…)
EDIT:
Issue has been fixed
Might you have this issue:
Disable Built-in-Ads extension at the service tab, whenever you use the Unity Ads package from the Asset Store.
1 Like