Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

IOException: Failed to Move File / Directory from 'Temp/StagingArea/Data' to 'Temp/StagingArea\asset

Discussion in 'Android' started by rmishell, Mar 21, 2017.

  1. rmishell

    rmishell

    Joined:
    Mar 16, 2017
    Posts:
    3
    Hi. Help please. When i try build Android Project on Windows from command line or gui (no difference), there is error.

    Code (CSharp):
    1. DisplayProgressbar: Creating staging area
    2. DisplayProgressbar: Preparing Unity resources
    3. IOException: Failed to Move File / Directory from 'Temp/StagingArea/Data' to 'Temp/StagingArea\assets\bin\Data'.
    4.   at (wrapper managed-to-native) UnityEditor.FileUtil:MoveFileOrDirectory (string,string)
    5.   at UnityEditor.Android.PostProcessor.Tasks.PrepareUnityResources.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
    6.   at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
    7.   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, UnityEditor.RuntimeClassRegistry usedClassRegistry) [0x00000] in <filename unknown>:0
    8.   at UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args) [0x00000] in <filename unknown>:0
    9.   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, UnityEditor.BuildReporting.BuildReport report) [0x000d4] in C:\buildslave\unity\build\Editor\Mono\BuildPipeline\PostprocessBuildPlayer.cs:186
    10. UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTarget, BuildOptions, Boolean)
    11. UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:267)
    12. UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:209)
    13. UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:184)
    14. UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:178)
    15. ProjectBuilder:GenericBuild(BuildTarget, BuildOptions, MobileTextureSubtarget, String, Boolean, Boolean) (at Assets\Scripts\Editor\ProjectBuilder.cs:164)
    16. ProjectBuilder:BuildAndroid() (at Assets\Scripts\Editor\ProjectBuilder.cs:180)
    Unity version is Unity 5.5.0f3 (64-bit)
    But build become success, when i try build after 10 or less times.
    Try build using Jenkins, but using command line problem apear too.
    Looks like Unity bug.
    Maybe there is a temporary solution?
     
    Last edited: Mar 21, 2017
  2. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    1. Upgrade your Unity version
    2. Use the Cloud Build if possible
     
  3. rmishell

    rmishell

    Joined:
    Mar 16, 2017
    Posts:
    3
    With latest Unity version i have the same ... :(
    Using cloud build unfortunately impossible for me...
     
  4. Auxonaut

    Auxonaut

    Joined:
    Mar 3, 2017
    Posts:
    4
    Started getting an error when attempting Android build stating:

    Error IOException: Failed to Move File / Directory from 'Temp/StagingArea/Data' to 'Temp/StagingArea\asset.

    After trying everything, the thing that got rid of the error was to switch off all Windows 10 anti-virus protection at same time as any extra anti-malware software.

    Then one by one, re-enable the anti-virus and anti-malware protection. The issue stayed resolved even after switching everything back on again.

    I suspect the problem could have been related to Windows 10 "Automatic Sample Submission" or "Controlled Folder Access". Hope this is useful for future folks with this error.
     
    davidolima, Meceka and Yury-Habets like this.
  5. Blachahaha

    Blachahaha

    Joined:
    Mar 16, 2018
    Posts:
    1
    I had this problem. Helped remove "StagingArea" from "PROJECT_PATH/Temp/".
     
    akareactor and misher like this.
  6. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    423
    I had this error in unity 5.6.5p2
    IOException: Failed to Move File / Directory from 'Temp/StagingArea/Data' to 'Temp/StagingArea/asd_Data'.
    Found out it was caused by MalwareBytes Real-time protection.
     
  7. Kobins

    Kobins

    Joined:
    Jan 13, 2018
    Posts:
    1
    Thx Meceka!
     
  8. CALMD0WNBR0

    CALMD0WNBR0

    Joined:
    Apr 23, 2018
    Posts:
    1
    This also fixed my project thank you.
     
  9. tobias_unity

    tobias_unity

    Joined:
    Feb 3, 2018
    Posts:
    66
    I also had this issue.

    Turns out that my disk space containing our Unity Project was almost full. I deleted some files and then it would build just fine.
     
    butterboxgame and drewgill89 like this.
  10. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
    I deleted the Temp directory and restarted Unity, worked
     
  11. davidolima

    davidolima

    Joined:
    Nov 4, 2021
    Posts:
    1
    That fixed it for me, thanks!

    For future reference:
    Disable Windows 10 Real-time protection:
    Win + X -> Settings -> Security -> Protection against virus and threats -> Manage settings (Under protection against virus and threats settings) -> Disable Real-time protection. (I disabled Cloud Protection as well, but I don't know if it's necessary.)
     
  12. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875
    I think you can exclude specific folders rather than disabling real-time protection, which is a safer choice :)
     
  13. wintlamar

    wintlamar

    Joined:
    Dec 7, 2021
    Posts:
    1
    care to explain ?
     
  14. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875