Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

UnauthorizedAccessException: Access to the path ... is denied.

Discussion in 'Editor & General Support' started by MildaGenius2, Sep 10, 2018.

  1. MildaGenius2

    MildaGenius2

    Joined:
    May 6, 2013
    Posts:
    19
    Hi,
    I have strange problem when building iOS project from command line in Unity 2018.2.5f1 on Mac 10.13.1.

    I can see that xCode project is preparing in Temp/StagingArea/Trampoline, but after some time I get this error about access denied to path, where are already created some files. The file Il2CppOptions.cpp already exist before error appears.

    I checked free space on disk, no antivirus, Temp is excluded from version control system. I dont have another glue, where can be the problem.

    Code (CSharp):
    1. UnauthorizedAccessException: Access to the path "/Users/builder/IYMBP-JOB1/Temp/StagingArea/Trampoline/Libraries/Il2CppOptions.cpp" is denied.
    2. System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    3. System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    4. (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
    5. System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    6. System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    7. System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    8. System.IO.StreamWriter..ctor (System.String path) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    9. (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string)
    10. UnityEditor.iOS.PostProcessiPhonePlayer.WriteIl2CppOptionsFile (System.String path, System.Boolean il2CppUseExceptions) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:944)
    11. UnityEditor.iOS.PostProcessiPhonePlayer.CrossCompileManagedDlls (UnityEditor.iOS.PostProcessiPhonePlayer+BuildSettings bs, UnityEditor.iOS.PostProcessiPhonePlayer+ProjectPaths paths, UnityEditor.AssemblyReferenceChecker checker, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport buildReport) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:842)
    12. UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.PostProcessiPhonePlayer+BuildSettings bs, UnityEditor.iOS.PostProcessiPhonePlayer+ProjectPaths paths, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport buildReport) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:660)
    13. UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.PostProcessorSettings postProcessorSettings, UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:611)
    14. UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/ExtensionModule.cs:37)
    15. UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:27)
    16. 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/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:287)
    17. UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
    18. BuildPipelineEx.<BuildPlayer>c__AnonStorey0:<>m__0() (at Assets/Plugins/Editor/BuildPipelineEx/BuildContext.cs:620)
    19. BuildPipelineEx.BuildContext:ExecuteWithBuildPlayerSettings(Func`1) (at Assets/Plugins/Editor/BuildPipelineEx/BuildContext.cs:633)
    20. BuildPipelineEx.BuildContext:BuildPlayer() (at Assets/Plugins/Editor/BuildPipelineEx/BuildContext.cs:620)
    21. BuildPipelineEx.CommandLineBuildBridge:RunBuild() (at Assets/Plugins/Editor/BuildPipelineEx/CommandLineBuildBridge.cs:542)
     
    Last edited: Sep 11, 2018
  2. MildaGenius2

    MildaGenius2

    Joined:
    May 6, 2013
    Posts:
    19
    So looks like the Unity installation is wrong.
    All files in /Applications/Unity/Hub/Editor/2018.2.5f1/PlaybackEngines/iOSSupport/ are read only. So after copying to Temp it is not possible to rewrite/modify it and build ends with UnauthorizedAccessException.




    Fix is change files attributes in iOSSupport.
    Code (CSharp):
    1.  sudo chmod -R ug+rw iOSSupport/
     

    Attached Files:

  3. MildaGenius2

    MildaGenius2

    Joined:
    May 6, 2013
    Posts:
    19
    When testing android build in Unity 2018.2.5f1, it looks like the same problem, but source files, in PlaybackEngines/AndroidPlayer have right (rw) attributes. So fix for iOS build is not possible to use :(.

    Code (CSharp):
    1. UnauthorizedAccessException: Access to the path "/Users/builder/Test/AndroidTest/Temp/StagingArea/res/values/strings.xml" is denied.
    2. System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:320)
    3. System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
    4. (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    5. System.Xml.XmlTextWriter..ctor (System.String filename, System.Text.Encoding encoding)
    6. UnityEditor.AndroidXmlDocument.SaveAs (System.String path)
    7. UnityEditor.AndroidXmlDocument.Save ()
    8. UnityEditor.Android.PostProcessor.Tasks.PrepareAPKResources.PatchStringsXml ()
    9. UnityEditor.Android.PostProcessor.Tasks.PrepareAPKResources.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    10. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    11. 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, UnityEditor.Build.Reporting.BuildReport report)
    12. UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties)
    13. UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:287)
    14. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    15.  
    Same problem, but on Windows machine.

    At end I test install lates Unity version 2018.2.14f1, where is possible build android build without UnauthorizedAccessException.
     
    Last edited: Oct 29, 2018
  4. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    186
    I'm getting this error on 2018.3.5f1 trying to build for iOs
     
  5. DreamEnder

    DreamEnder

    Joined:
    Apr 12, 2011
    Posts:
    190
    Same here.
     
  6. Tepat

    Tepat

    Joined:
    Sep 8, 2017
    Posts:
    1
    Same here
     
  7. JPhilipp

    JPhilipp

    Joined:
    Oct 7, 2014
    Posts:
    55
    Sigh, same here
     
  8. Biosoftworld

    Biosoftworld

    Joined:
    Jan 24, 2019
    Posts:
    3
    Same here. Is someone listen..?
     
  9. Brastik

    Brastik

    Joined:
    Mar 12, 2013
    Posts:
    10
    Got the error while building iOS on Mac "UnauthorizedAccessException: Access to the path '/Applications/Unity/PlaybackEngines/iOSSupport/Trampoline/build/SharedPrecompiledHeaders' is denied."

    So I guess it doesn't have write access to the PlaybackEngines folder. Then I went to Applications/Unity/PlaybackEngines > right click > Get Info > Click the lock icon at the bottom to make changes > Set all to "Read & Write" permission > Continue as in the screenshot and I can build smoothly.
     

    Attached Files:

    dkalinda likes this.
  10. Bodin

    Bodin

    Joined:
    Apr 19, 2017
    Posts:
    23

    Thank you very much! This solution solved my problem.
     
  11. dkalinda

    dkalinda

    Joined:
    May 27, 2019
    Posts:
    2

    This worked! Thank you:)
     
unityunity