Sorry if this isnt the right place to post it!
Im trying to build my game to Android, i installed Android Studio, Installed Google USB Driver, Connected my phone, Enabled DEV Mode, Enabled USB Debugging, Installed Java JDK, Pointed Unity preferences to the SDK and the Java JDK,
And im getting this error, when im building normal
’
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk-9.0.1\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.
]
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.Action1 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)
I found out that i have to use possibly Gradle 4.2.1
Second, when i try to build and run to my phone im getting:
But that might be because Gradle doesnt work at all.
Thanks for any help, pretty stuck haha
~Luc
Thalv
December 31, 2017, 12:23am
2
I started thursday off with that same issue man
I am having a major issue on my main machine after upgrading. I can no longer get Unity to build for android apps. I know the SDK and file paths are correct. I even replaced the tools folder in the Android SDK section as suggested after the upgrade. I am at a loss now and about to start using another editor all together.
[3337047--260408--upload_2017-12-30_0-9-24.jpg]
[3337047--260408--upload_2017-12-30_0-9-24.jpg]
I guess i placed this in the wrong forum section,
anyway, i cant get to fix it, i downgraded JDK to 8 Update 151 now… Android Studio 3.0.1
But still Gradle Failed
I found out the problem, but no solutions yet,
I cant build the APK nor Run it when i have ADS enabled,
i get this error:
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.Action1 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)
It already says
Cannot add task ‘:prepareUnityAdsLibrary’ as a task with that name already exists.
So i disabled ADS en it worked, but i need the ads haha how do i make it work WITH ads?