Search Unity

Resolved System.ComponentModel.Win32Exception (2): No such file or directory

Discussion in 'Android' started by freedom667, Oct 4, 2021.

  1. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    Why do I get this error when build for android aab?

    Code (CSharp):
    1. Exception: System.ComponentModel.Win32Exception (2): No such file or directory
    2.    at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
    3.    at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
    4.    at System.Diagnostics.Process.Start()
    5.    at Unity.IL2CPP.Shell.SetupAndStart(ExecuteContext context, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 423
    6.    at Unity.IL2CPP.Shell.ExecuteAsync(ExecuteArgs executeArgs, IExecuteController controller, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 299
    7.    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 355
    8.    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 331
    9.    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/ParallelFor.cs:line 78
    10. UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:129)
    11. UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:65)
    12. UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:814)
    13. UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:782)
    14. UnityEditorInternal.IL2CPPBuilder.Run () (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:608)
    15. UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:273)
    16. UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    17. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    18. 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 <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    19. UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    20. 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 /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:337)
    21. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
    22.  
     
  2. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    anybody help?
     
  3. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    I suspect that the C++ compiler from the Android NDK cannot be located properly. Please confirm that the Android NDK is installed. It should be possible to install the NDK from the Unity Hub.
     
  4. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    Android NDK is already truly located. I didn't get it why gives this error
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    Maybe try to re-install the NDK and Unity then. I'm not sure where Unity is looking for the NDK in this case, but it seems to be the wrong place.
     
  6. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    now giving this error
    Code (CSharp):
    1. > Configure project :launcher
    2. WARNING: The option 'android.enableR8' is deprecated and should not be used anymore.
    3. It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.
    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.6.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    3.  
    4. stderr[
    5. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    6.  
    7. FAILURE: Build failed with an exception.
    8.  
    9. * What went wrong:
    10. A problem occurred configuring project ':launcher'.
    11. > android.defaultConfig.versionCode is set to 0, but it should be a positive integer.
    12.   See https://developer.android.com/studio/publish/versioning#appversioning for more information.
    13.  
    14. * Try:
    15. 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.
    16.  
    17. * Get more help at https://help.gradle.org
    18.  
    19. BUİLD FAILED in 2s
    20. ]
    21. stdout[
    22.  
    23. > Configure project :launcher
    24. WARNING: The option 'android.enableR8' is deprecated and should not be used anymore.
    25. It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.
    26. ]
    27. exit code: 1
    28. UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    29. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    30. UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    31. UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    32. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    33. Rethrow as GradleInvokationException: Gradle build failed
    34. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    35. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    36. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    37. Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
    38. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    39. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    40. 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 <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    41. UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <f4fe6ee0eb194a68ba39f2b771ad357b>:0)
    42. 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 /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:337)
    43. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
    44.  
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    I'm not sure what this error means. @Tomas1856 can you help?
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,902
    Code (CSharp):
    1. android.defaultConfig.versionCode is set to 0, but it should be a positive integer.
    Please make your version number a positive number in PlayerSettings
     
  9. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    R8 issue is happening because of API Target 31
     
  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,902
    That's a warning, it shouldn't block you. Check the version code.
     
  11. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    it is because of API 31. I did API 30 and fixed. Also, why does r8 appear active in gradle template when it is not in player settings? it is ridiculous
     
  12. Tauseef_Ahmaad

    Tauseef_Ahmaad

    Joined:
    Feb 8, 2022
    Posts:
    3
    Unity 2020.3.28f1 WebGL build failed on macOS Monterey 12.3


    @Tomas1856 @JoshPeterson

    System.ComponentModel.Win32Exception (2): No such file or directory
    at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
    at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
    at System.Diagnostics.Process.Start()
    at Unity.IL2CPP.Shell.SetupAndStart(ExecuteContext context, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 423
    at Unity.IL2CPP.Shell.ExecuteAsync(ExecuteArgs executeArgs, IExecuteController controller, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 299
    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 355
    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 334
    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/ParallelFor.cs:line 78
     
  13. leanhquang2803

    leanhquang2803

    Joined:
    Dec 18, 2021
    Posts:
    2
    I have the same problem.
     
  14. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    This seems like a different issue from the one reported in this thread originally, as the original discussion was about and Android player build.

    However, I suspect that the issue here has something to do with the Emscripten installation. Do you happen to have Emscripten installed separately on this machine? Unity should ship with its own Emscripten installation that works, but I wonder if IL2CPP is picking up a different one.
     
  15. Deleted User

    Deleted User

    Guest

    The same thing is happening to me (not the Android build) but just building out this project in general. I created a thread for it here.
     
  16. Aatifahmad

    Aatifahmad

    Joined:
    Mar 8, 2018
    Posts:
    3
    i just updated my mac to 12.3.1 and now showing this! Did you fixed it? if yes how?
     
    michcros1220 likes this.
  17. keffen611

    keffen611

    Joined:
    Jan 30, 2022
    Posts:
    1
    same here.
     
    michcros1220 likes this.
  18. michcros1220

    michcros1220

    Joined:
    Apr 12, 2022
    Posts:
    2
    For the WebGL build I'm getting the same (also running OSX Monterey 12.3) and @JoshPeterson I'm running 2020.3.32f1 and have not installed any additional ECMA Script stuff. This is a new computer with only Unity installed, GIMP and Blender. Very plain vanilla. Let me know how to analyze multiple IL2CPP issues and I'd be happy to do the leg work.
     
  19. d2mstudio

    d2mstudio

    Joined:
    Jul 23, 2020
    Posts:
    3
    Hi guy,
    Try to create class in Asset folder with name "WebglPreBuildProcessing" and script as below. Note that: the path should change for current python version: Versions/3.10/bin/python3.10

    Then build again. Hope to resolve this case
    1. #if UNITY_EDITOR
    2. using UnityEditor.Build;
    3. using UnityEditor.Build.Reporting;

    4. public class WebglPreBuildProcessing : IPreprocessBuildWithReport
    5. {
    6. public int callbackOrder => 1;
    7. public void OnPreprocessBuild(BuildReport report)
    8. {
    9. System.Environment.SetEnvironmentVariable("EMSDK_PYTHON", "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10");
    10. }
    11. }
    12. #endif
     
    hm_assets, Sycab and SonicBloomEric like this.
  20. aweterence

    aweterence

    Joined:
    Apr 28, 2022
    Posts:
    1
    Hi guys, I'm having the same issue and I also running OSX Monterey 12.3.1. Did anyone have any idea of how to solve this problem?
     
  21. pofu_lu

    pofu_lu

    Joined:
    Feb 5, 2019
    Posts:
    4
    mekartikshah likes this.
  22. Sycab

    Sycab

    Joined:
    Jul 11, 2020
    Posts:
    10
    This has fixed the issue for me as well, thank you A LOT!!
    I tried building for WebGL on macOS Monterey 12.5.
     
  23. lorizju

    lorizju

    Joined:
    Mar 11, 2016
    Posts:
    7
    Thank you very much. You save my day!
     
  24. jg_ersindemir

    jg_ersindemir

    Joined:
    Oct 15, 2014
    Posts:
    1
    Update Unity Editor to 2020.3.41f1 then problem is fixed. Good Luck :) for Mac OS 12.6.1