For reference, I am using Unity 2019.4.9f1 and building with Android API 30.
I have searched every corner of the internet and I am unable to find a solution.
This error is strange as it has appeard randomly after I have done countless builds for Android in the past. I'm thinking maybe Windows update broke something.
Each time I build for Android (using IL2CPP for both ARMv7 and ARM64 architectures) I am getting the following errors:

Failed running C:\Program Files\Unity\Hub\Editor\2019.4.9f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe --compile-cpp --libil2cpp-static --platform="Android" --architecture="ARM64" --configuration="Release" --outputpath="C:\Users\omar1\OneDrive\Desktop\PixiRabbit\Temp\StagingArea\assets\bin\Data\Native\arm64-v8a\libil2cpp.so" --cachedirectory="C:\Users\omar1\OneDrive\Desktop\PixiRabbit\Assets\..\Library\il2cpp_android_arm64-v8a/il2cpp_cache" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019.4.9f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\bdwgc/include" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019.4.9f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\libil2cpp/include" --tool-chain-path="C:/Program Files/Unity/Hub/Editor/2019.4.9f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK" --map-file-parser="C:/Program Files/Unity/Hub/Editor/2019.4.9f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --generatedcppdir=C:/Users/omar1/OneDrive/Desktop/PixiRabbit/Temp/StagingArea/Il2Cpp/il2cppOutput --dotnetprofile="unityaot"
stdout:
Building libil2cpp.so with AndroidToolChain
Output directory: C:\Users\omar1\OneDrive\Desktop\PixiRabbit\Temp\StagingArea\assets\bin\Data\Native\arm64-v8a
Cache directory: C:\Users\omar1\OneDrive\Desktop\PixiRabbit\Library\il2cpp_android_arm64-v8a\il2cpp_cache
ObjectFiles: 157 of which compiled: 0
Total compilation time: 115 milliseconds.
**il2cpp.exe didn't catch exception: System.IO.IOException: Access to the path 'C:\Users\omar1\OneDrive\Desktop\PixiRabbit\Library\il2cpp_android_arm64-v8a\il2cpp_cache\linkresult_8E417845F41A6236948E52CE0D7BBBA7' is denied.**
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at NiceIO.NPath.Delete(DeleteMode deleteMode)
at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Program.DoRun(String[] args, List`1 foundAssemblies)
at il2cpp.Program.Run(String[] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[] args)
stderr:
**Unhandled Exception: System.IO.IOException: Access to the path 'C:\Users\omar1\OneDrive\Desktop\PixiRabbit\Library\il2cpp_android_arm64-v8a\il2cpp_cache\linkresult_8E417845F41A6236948E52CE0D7BBBA7' is denied.**
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at NiceIO.NPath.Delete(DeleteMode deleteMode)
at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Program.DoRun(String[] args, List`1 foundAssemblies)
at il2cpp.Program.Run(String[] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[] args)
UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1)
UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String)
UnityEditorInternal.IL2CPPBuilder:RunCompileAndLink()
UnityEditorInternal.IL2CPPUtils:RunCompileAndLink(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
I have tried:
- reinstalling Unity 2019.4.9f1
- reinstalling the Android module and il2cpp module
- running Unity as admin
- using Android 29 instead of 30
- restarting my computer
- moving the project to my desktop
- deleting Library\il2cpp_android_arm64-v8a\il2cpp_cache
Any suggestions or help on this issue will be greatly appreciated.
Thanks, Omar