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

Question It seems like i can't build android projects on Unity anymore

Discussion in 'Editor & General Support' started by successfulah, Jun 9, 2020.

  1. successfulah

    successfulah

    Joined:
    Apr 18, 2019
    Posts:
    3
    I removed all the unity versions, Unity Hub as well and I reinstalled them but I didn't work and I still can't build, I tried to build an empty project as well but I didn't work on the other hand I can build PC project, that bug appeared after trying the IronSource mediation I don't know if that can help.

    1st Error

    CommandWithNoStdoutInvokationFailure: Gradle initialization failed.
    UnityEditor.Android.Command.RunWithShellExecute (System.String command, System.String args, System.String workingdir, System.String errorMsg) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.AndroidJavaTools.RunJavaWithShellExecute (System.String args, System.String workingdir, System.String error) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    Rethrow as GradleInvokationException: Gradle initialization failed.
    UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessAndroidPlayer+<ExecuteWarmup>c__AnonStorey0.<>m__0 () (at <502f1b7df2d7430696af84c6f02852ed>:0)
    System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <567df3e0919241ba98db88bec4c6696f>:0)
    System.Threading.ThreadHelper.ThreadStart () (at <567df3e0919241ba98db88bec4c6696f>:0)
    UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs) (at C:/buildslave/unity/build/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46)


    Error 2:



    Could not write cache value to 'C:\Users\admin\.gradle\daemon\5.1.1\registry.bin'.

    UnityEngine.GUIUtility:processEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)



    Error 3



    CommandInvokationFailure: Gradle build failed.
    E:/UnityVers/2019.2.17f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "E:\UnityVers\2019.2.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

    stderr[

    FAILURE: Build failed with an exception.

    * What went wrong:
    Could not write cache value to 'C:\Users\admin\.gradle\daemon\5.1.1\registry.bin'.

    * 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
    ]
    stdout[

    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <502f1b7df2d7430696af84c6f02852ed>: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 <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, 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 C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr) (at
     
  2. adrolter

    adrolter

    Joined:
    Jan 10, 2019
    Posts:
    5
    Does C:\Users\admin\.gradle\daemon\5.1.1\ exist and is it writable?
     
  3. successfulah

    successfulah

    Joined:
    Apr 18, 2019
    Posts:
    3
    No, it doesn't exist, actually .gradle doesn't exist at for some reason, how can I solve this issue
     
  4. successfulah

    successfulah

    Joined:
    Apr 18, 2019
    Posts:
    3
    Thank you adrolter, the problem was on the .Gradle somehow it didn't work and the computer was hiding its folder, I solved it by deleting the .gradle folder completely then restarted the computer then builded an empty project again ( i think you have to be connected to the internet so the unity will create another .gradle file).