Android Build Failure: NullReferenceException

Hey! I just migrated our Oculus Quest project and am getting this error. I’ve gotten the error once before but solved it by re-downloading the Android SDK & NDK. That didn’t solve it this time though. So far I’ve had the issue trying to build in Unity 2019.2.3f and in 2019.3.0f on windows 10.

other things I’ve tried:

  • Reimporting all assets
  • Changing “tools” directory from read-only

Does anybody have a concrete solution to this issue? All of the solutions I’ve found online are things that I’ve already tried. Thanks!

Full error log in console:
NullReferenceException: Object reference not set to an instance of an object UnityEditor.XR.Oculus.OculusManifest.UpdateOrCreateNameValueElementsInTag (System.Xml.XmlDocument doc, System.String parentPath, System.String tag, System.String firstName, System.String firstValue, System.String secondName, System.String secondValue, System.String thirdName, System.String thirdValue) (at Library/PackageCache/com.unity.xr.oculus.android@1.38.3/Editor/OculusBuildProcessor.cs:60) UnityEditor.XR.Oculus.OculusManifest.OnPostGenerateGradleAndroidProject (System.String path) (at Library/PackageCache/com.unity.xr.oculus.android@1.38.3/Editor/OculusBuildProcessor.cs:130) UnityEditor.Android.AndroidBuildPipelineInterfaces.OnGeneratePlatformProjectPostprocess (System.String path, System.Boolean strict) (at <3b74787e58694cdda2c241162159b3b7>:0) UnityEditor.Android.PostProcessor.Tasks.ExportProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5b6dae0b592a492ba620e07746542d5c>:0) Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <5b6dae0b592a492ba620e07746542d5c>:0) UnityEditor.Android.PostProcessor.Tasks.ExportProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5b6dae0b592a492ba620e07746542d5c>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5b6dae0b592a492ba620e07746542d5c>:0) 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 <5b6dae0b592a492ba620e07746542d5c>:0) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <5b6dae0b592a492ba620e07746542d5c>:0) 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 <3b74787e58694cdda2c241162159b3b7>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

This seems to only be an issue with only version 1.38.3 of com.unity.xr.oculus.android. I was able to get it working by updating the package (to 1.38.6). All credit to @CStampGames, wouldn’t of thought to do that until I expanded the comments to this question!