Android Build Error - Value cannot be null.

Hello everyone, I’m trying to get the Android version of my game running and I’m not having any luck. Here is the error I’m seeing when I try to build:

ArgumentNullException: Value cannot be null.

Parameter name: path1
System.IO.Path.Combine (System.String path1, System.String path2) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
UnityEditor.Android.AndroidComponentProperties.Read (System.String directory) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.AndroidComponentProperties.GetPackageRevision (System.String directory) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.AndroidSDKTools.BuildToolsVersion () (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKBuildToolsDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools, UnityEditor.Android.AndroidJavaTools javaTools) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, UnityEditor.Android.AndroidJavaTools javaTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (UnityEditor.Android.AndroidJavaTools javaTools, System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector detector) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.PostprocessBuildPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:106)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Here is what I have tried: Restart Unity, Reinstall Unity, Update Android SDK/Android Studio, Update JDK, Change Target API

Here is my environment: Unity - 2019.1.2f1, JDK - 1.8.0_212, Android Studio with latest SDK updates.

After searching around for this error, it appears I’m not the only one with this issue and there hasn’t been a solid resolution posted. Does anyone have any ideas? I would appreciate any help you could offer!

@chadq Just try to go to Edit → Preference → External Tools and check Gradle installed with Unity. It started to work like a charm for me. I was trying to uninstall and install Unity, check Autographics API, reimport all assets but nothing to work. Only check Gradle installed with Unity helped me.

Go to Android PlayerSettings Enable Auto Graphics API

Hi,

I have same error, but after install manually the JDK :
https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html
It’s work fine.