Search Issue Tracker

Fixed in 2019.3.X

Fixed in 2017.4.X, 2018.4.X, 2019.1.X, 2019.2.X

Votes

0

Found in

2019.1.7f1

2019.2.0b6

Issue ID

1164013

Regression

Yes

[Android] Gradle build fails when there's a settings.gradle file in the project folder

Mobile

-

Repro steps:
1. Open attached project
2. Build for Android

Actual: Build fails with "Project directory 'C:\Users\user.name\Documents\Projects\ProjectFolder\Temp\gradleOut' is not part of the build defined by settings file 'C:\Users\user.name\Documents\Projects\ProjectFolder\settings.gradle'. If this is an unrelated build, it must have its own settings file."

Reproducible with: 2019.1.12f1, 2019.2.0b10
Didn't reproduce on: 2017.4.29f1, 2018.4.3f1, 2019.1.6f1, 2019.2.0b5, 2019.3.0a5

Notes:
- Build succeeds throughout 2019.3 but since 2019.3.0a6 there's a "CommandWithNoStdoutInvokationFailure: Gradle initialization failed." error thrown after the build

  1. Resolution Note (fix version 2019.3):

Comments (5)

  1. successfulah

    Jun 10, 2020 16:59

    I'm also having this problem on unity 2019.4.0f1, if there is a manual fix or something I can do, please guide me.
    CommandWithNoStdoutInvokationFailure: Gradle initialization failed.
    UnityEditor.Android.Command.RunWithShellExecute (System.String command, System.String args, System.String workingdir, System.String errorMsg) (at <3167064085404657b0d6c498207da025>:0)
    UnityEditor.Android.AndroidJavaTools.RunJavaWithShellExecute (System.String args, System.String workingdir, System.String error) (at <3167064085404657b0d6c498207da025>:0)
    UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at <3167064085404657b0d6c498207da025>:0)
    Rethrow as GradleInvokationException: Gradle initialization failed.
    UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at <3167064085404657b0d6c498207da025>:0)
    UnityEditor.Android.PostProcessAndroidPlayer+<>c__DisplayClass3_0.<ExecuteWarmup>b__0 () (at <3167064085404657b0d6c498207da025>:0)
    System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Threading.ThreadHelper.ThreadStart () (at <437ba245d8404784b9fbab9b439ac908>:0)
    UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)

  2. successfulah

    Jun 10, 2020 16:57

    I also have this issue on unity 2019.4.0f1, please fix it or if there is a manual fix please guide me.

    CommandWithNoStdoutInvokationFailure: Gradle initialization failed.
    UnityEditor.Android.Command.RunWithShellExecute (System.String command, System.String args, System.String workingdir, System.String errorMsg) (at <3167064085404657b0d6c498207da025>:0)
    UnityEditor.Android.AndroidJavaTools.RunJavaWithShellExecute (System.String args, System.String workingdir, System.String error) (at <3167064085404657b0d6c498207da025>:0)
    UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at <3167064085404657b0d6c498207da025>:0)
    Rethrow as GradleInvokationException: Gradle initialization failed.
    UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at <3167064085404657b0d6c498207da025>:0)
    UnityEditor.Android.PostProcessAndroidPlayer+<>c__DisplayClass3_0.<ExecuteWarmup>b__0 () (at <3167064085404657b0d6c498207da025>:0)
    System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Threading.ThreadHelper.ThreadStart () (at <437ba245d8404784b9fbab9b439ac908>:0)
    UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)

  3. eventropy

    Mar 11, 2020 17:14

    This seems to work as a workaround:
    ```
    class UnityGradleErrorHackWorkaround : IPostGenerateGradleAndroidProject {
    public int callbackOrder { get { return 0; } }
    public void OnPostGenerateGradleAndroidProject(string path) {
    File.WriteAllText(Path.Combine(path, "settings.gradle"), "");
    }
    }
    ```

  4. eventropy

    Mar 11, 2020 08:13

    Yeah this happens on 2018.4.15f1. Can we get this added to 2018.4 LTS please?

  5. pdafedar

    Sep 09, 2019 08:56

    When can we expect this issue fix in the 2018.4 LTS version? I can still able to reproduce this in 2018.4.8f1 (latest LTS atm)

    FAILURE: Build failed with an exception.

    * What went wrong:
    Project directory '/Volumes/workspace/Repository/HelloWorldGame/GameContainer/Temp/StagingArea/gradleWarmupArea' is not part of the build defined by settings file '/Volumes/workspace/Repository/HelloWorldGame/settings.gradle'. If this is an unrelated build, it must have its own settings file.

    * 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 3s
    Uploading Crash Report
    CommandWithNoStdoutInvokationFailure: Gradle initialization failed.
    at UnityEditor.Android.Command.RunWithShellExecute (System.String command, System.String args, System.String workingdir, System.String errorMsg) [0x00058] in <62f761e6ab1445a38cdcb4ac36512695>:0
    at UnityEditor.Android.AndroidJavaTools.RunJavaWithShellExecute (System.String args, System.String workingdir, System.String error) [0x00007] in <62f761e6ab1445a38cdcb4ac36512695>:0
    at UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) [0x0000f] in <62f761e6ab1445a38cdcb4ac36512695>:0
    Rethrow as GradleInvokationException: Gradle initialization failed.
    at UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) [0x0002f] in <62f761e6ab1445a38cdcb4ac36512695>:0
    at UnityEditor.Android.PostProcessAndroidPlayer+<ExecuteWarmup>c__AnonStorey0.<>m__0 () [0x00001] in <62f761e6ab1445a38cdcb4ac36512695>:0
    at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <df7127ba07dc446d9f5831a0ec7b1d63>:0
    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <df7127ba07dc446d9f5831a0ec7b1d63>:0
    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <df7127ba07dc446d9f5831a0ec7b1d63>:0
    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <df7127ba07dc446d9f5831a0ec7b1d63>:0
    at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <df7127ba07dc446d9f5831a0ec7b1d63>:0
    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    UnityEngine.Logger:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnhandledExceptionHandler.bindings.cs:47)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.