Hi guys how are you?
I’m having a build problem at Unity with gradle, I’ve been trying to solve this problem for some time, but I have not been able to do anything at the moment. I would appreciate some help, really!
Problem occurs when I try to build my apk with gradle, that’s the problem
And this is the log
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Java\jdk1.8.0_162\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.2.0b10\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.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'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle.jar (com.android.tools.build:gradle:3.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
> Could not find layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/layoutlib/layoutlib-api/26.0.1/layoutlib-api-26.0.1.jar
> Could not find apksig.jar (com.android.tools.build:apksig:3.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/apksig/3.0.1/apksig-3.0.1.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 54s
]
stdout[
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
]
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.Action`1 progress, System.String error)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, 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)
Already tried
- Update the JDK
- Downgrade JDK
- Use another version of Unity
- Reinstall the JDK and SDK
- Only let the SDK 26/27 or 28 installed
- Update Android Studio
- Reinstall Unity
- Install all SDK tools using the Android Studio SDK Manager
None of these things helped me…
I’m using
- Unity 2018.2.0b10
- Android Studio 3.1.3
- JDK 1.8.0_172
- Android SDK 27
- A completely clean project on Unity