Hello! I keep getting these console messages when I try to build and run a project for Android in Unity:
Win32Exception: The system cannot find the file specified.
Error building Player: Win32Exception: The system cannot find the file specified.
This shows up in my editor log right after the Android SDK and Java paths:
Error Log
Win32Exception: The system cannot find the file specified.
at System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0
at System.Diagnostics.Process.Start () [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()
at UnityEditor.Android.ADB.StartServer (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit) [0x00000] in :0
at UnityEditor.Android.ADB.Run (System.String[ ] command, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in :0
at UnityEditor.Android.ADB.Devices (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit) [0x00000] in :0
at UnityEditor.Android.PostProcessAndroidPlayer.FindDevice () [0x00000] in :0
at UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options) [0x00000] in :0
at UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options) [0x00000] in :0
at UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args) [0x00000] in :0
at UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) [0x000c5] in C:\buildslave\unity\build\Editor\Mono\BuildPipeline\PostprocessBuildPlayer.cs:316
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[ ], String, BuildTarget, BuildOptions, Boolean, UInt32&)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean, BuildOptions, Boolean) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:655)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean, BuildOptions) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:452)
UnityEditor.BuildPlayerWindow:GUIBuildButtons(Boolean, Boolean, Boolean, BuildPlatform) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:1474)
UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings() (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:1425)
UnityEditor.BuildPlayerWindow:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:1046)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[ ], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[ ]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:244)
UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:237)
UnityEditor.HostView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:129)
(Filename: C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs Line: 316)
DisplayProgressNotification: Build Failed
Error building Player: Win32Exception: The system cannot find the file specified.
(Filename: Line: -1)
Some additional information:
I’m trying to build this on my laptop running Windows 8.1. I built the same project on my Windows 7 desktop with no problem. Also, choosing “build” instead of “build and run” finishes with no problem.
The laptop also gives the same problem when trying to build and run an empty project for Android, so it’s not just my project. I’ve built projects for Android on this laptop before (in Unity 4.x), so I don’t think I have a problem with my SDK or Java variables. I’m not ruling those out, however, because the problem definitely seems Android-related.
I’ve also tried to build and run on multiple Android devices, so I don’t think the problem is driver related. I ran ADB from the command line to make sure it was communicating with the devices.
The problem also persists after updating from 5.0.0.f4 to 5.0.0.p3. I saw another thread with a similar problem that was fixed by updating to p3.
I’m also not exactly sure what file name is missing. I’ve seen a few other people with similar errors, but the exact file name was always stated immediately after the error in the stacktrace. “Filename: C:/buildslave/…/PostprocessBuildPlayer.cs Line: 316” near the end sounds like it’s part of the stacktrace because it includes a line number, so is “(Filename: Line: -1)” the missing file? It also says near the top so I could be missing a file somewhere?
It also seems weird that the stacktrace is showing “C:/buildslave/…” because I have Unity installed on my D partition, but I don’t understand the Unity/Mono build process well enough to know if this is a real problem, but I saw a thread where someone mentioned a bug related to Unity 5 not being installed on the C drive, so that’s the only reason I mentioned this. I may try to move it from my D partition to C if I don’t hear anything soon. Or I might try a fresh reinstall of everything.
Any ideas?