Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Gradle build failed

Discussion in 'Android' started by Jonny2009, Jul 26, 2022.

  1. Jonny2009

    Jonny2009

    Joined:
    Jul 13, 2021
    Posts:
    1
    I am getting the error "gradle build failed".

    console:

    CommandInvokationFailure: Gradle build failed.
    C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease"
    stderr[
    FAILURE: Build failed with an exception.
    * Where:
    Build file 'C:\Users\jonat\Documents\Unity\Weise Sprüche fürs Leben\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1
    * What went wrong:
    A problem occurred evaluating project ':launcher'.
    > Failed to apply plugin [id 'com.android.internal.application']
    > Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.
    * 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 2s
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    ]
    stdout[
    Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0bc7e9c04c1540528b26863a0cb726ae>: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 <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, 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 <44a70d1b13cf47e29810e30f45ffae08>:0)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
     
  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,858
    The path of your project may be having special characters (usually non-english characters). Try moving it to a different path.
     
  3. damonro

    damonro

    Joined:
    Sep 19, 2020
    Posts:
    2
    Hi.
    I'm getting de same error since like a month ago and I really don't know what to do.
    Did you find something?

    Here is my error:

    FIRST ONE:

    FAILURE: Build failed with an exception.

    * Where:
    Build file 'D:\Unity projects\Witches Dogs and Puppies\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1

    * What went wrong:
    A problem occurred evaluating project ':launcher'.
    > Plugin with id 'com.android.application' not found.

    * 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 618ms
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    SECOND ONE:


    CommandInvokationFailure: Gradle build failed.
    C:\Program Files\Java\jdk1.8.0_77\bin\java.exe -classpath "D:\Unity versions\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle-7.0\lib\gradle-launcher-7.0.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

    stderr[

    FAILURE: Build failed with an exception.

    * Where:
    Build file 'D:\Unity projects\Witches Dogs and Puppies\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1

    * What went wrong:
    A problem occurred evaluating project ':launcher'.
    > Plugin with id 'com.android.application' not found.

    * 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 618ms
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    ]
    stdout[

    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0bc7e9c04c1540528b26863a0cb726ae>: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 <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, 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 <44a70d1b13cf47e29810e30f45ffae08>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  4. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,858
    Looks like you may have custom gradle files wrongly edited.
    Please share this file -> D:\Unity projects\Witches Dogs and Puppies\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle
     
  5. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    168