- Home /
How to fix build errors when building as APK
When I go to build my project, I get 3 errors.
I am using Unity 2019.2.3f1
I've been looking all day for a solution, yet nothing seems to work. I do not understand the nature of these error messages.
Yes, I have correctly set the path to the SDK and attempted to downgrade the 'tools' folder to previous versions such as 25.23.
JDK version is the default 1.8.0_152. Attempting to upgrade/downgrade the JDK simply doesn't allow it. Same thing goes for the NDK, any upgrade/downgrade doesn't get accepted.
When I play the game in the Editor, it plays fine but outputs an error when a video ad appears. The video ad functionality seems to work fine and the game still continues as normal after, but could the error have something to do with build fail?
The error is "NullReferenceException: Object reference not set to an instance of an object". There are also several warnings when the game starts; I don't know if that could affect the build either (warnings and all errors are in the Editor.log provided below) Any help is greatly appreciated, I have no other solutions.
Here are the errors:
1- "UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:190 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:95 UnityEngine.GUIUtility:processEvent(Int32, IntPtr)"
2- "Build completed with a result of 'Failed' UnityEngine.GUIUtility:processEvent(Int32, IntPtr)"
3-" ArgumentNullException: Value cannot be null. Parameter name: path1 System.IO.Path.Combine (System.String path1, System.String path2) (at :0) UnityEditor.Utils.Paths.Combine (System.String[] components) (at C:/buildslave/unity/build/Editor/Mono/Utils/Paths.cs:29) UnityEditor.Android.AndroidGradleRoot.GetGradleLaunchJarPath (System.String directory) (at :0) UnityEditor.Android.GradleWrapper.GetBaseCommand (System.Int32 jvmHeapSize) (at :0) UnityEditor.Android.PostProcessAndroidPlayer.ExecuteWarmup (System.String stagingArea) (at :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 :0) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at :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 C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281) UnityEngine.GUIUtility:processEvent(Int32, IntPtr)"
Answer by dm_bond · Dec 01, 2019 at 12:16 AM
Check Edit > Preferences > External Tool > Gradle Installed with Unity is enabled
Your answer
![](https://koobas.hobune.stream/wayback/20220612212116im_/https://answers.unity.com/themes/thub/images/avi.jpg)