- Home /
Building for android freezes unity editor
My project works fine on the unity editor, but everytime I try to build for android the process freezes after a few seconds, always loading scene 0. The only error I get is when I play on the Editor or open the project, you can see it's logs below:
Stopped polling job due to exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at UnityEditor.Android.AndroidSDKTools.RunCommand (UnityEditor.Android.AndroidJavaTools javaTools, System.String[] sdkToolCommand, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00001] in <5c71878999f0497585d65b3e22368ad9>:0
at UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.AndroidJavaTools javaTools) [0x00029] in <5c71878999f0497585d65b3e22368ad9>:0
at UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.AndroidJavaTools javaTools) [0x00003] in <5c71878999f0497585d65b3e22368ad9>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <f826c2584fc94ec19a48a6576640bdc5>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <f826c2584fc94ec19a48a6576640bdc5>:0
at GooglePlayServices.UnityCompat.FindNewestInstalledAndroidSDKVersion () [0x0011c] in Z:\tmp\tmp.lDxf0Zsaxo\third_party\unity\unity_jar_resolver\source\PlayServicesResolver\src\UnityCompat.cs:279
at GooglePlayServices.UnityCompat.GetAndroidTargetSDKVersion () [0x0004d] in Z:\tmp\tmp.lDxf0Zsaxo\third_party\unity\unity_jar_resolver\source\PlayServicesResolver\src\UnityCompat.cs:120
at GooglePlayServices.PlayServicesResolver.CanEnableJetifierOrPromptUser (System.String titlePrefix) [0x000ae] in Z:\tmp\tmp.lDxf0Zsaxo\third_party\unity\unity_jar_resolver\source\PlayServicesResolver\src\PlayServicesResolver.cs:2221
at GooglePlayServices.GradleResolver+<GradleResolution>c__AnonStorey1.<>m__8 (System.Collections.Generic.HashSet`1[T] unusedUnlabeled) [0x00021] in Z:\tmp\tmp.lDxf0Zsaxo\third_party\unity\unity_jar_resolver\source\PlayServicesResolver\src\GradleResolver.cs:911
at GooglePlayServices.PlayServicesResolver+<LabelAssets>c__AnonStoreyB.<>m__0 () [0x001ab] in Z:\tmp\tmp.lDxf0Zsaxo\third_party\unity\unity_jar_resolver\source\PlayServicesResolver\src\PlayServicesResolver.cs:2103
at Google.RunOnMainThread.ExecutePollingJobs () [0x0004a] in Z:\tmp\tmp.MFNLcXgkvt\third_party\unity\unity_jar_resolver\source\VersionHandlerImpl\src\RunOnMainThread.cs:300
UnityEngine.Debug:LogError(Object)
Google.RunOnMainThread:ExecutePollingJobs() (at Z:/tmp/tmp.MFNLcXgkvt/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:303)
Google.RunOnMainThread:<ExecuteAll>m__1() (at Z:/tmp/tmp.MFNLcXgkvt/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:414)
Google.RunOnMainThread:RunAction(Action) (at Z:/tmp/tmp.MFNLcXgkvt/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:234)
Google.RunOnMainThread:ExecuteAll() (at Z:/tmp/tmp.MFNLcXgkvt/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:406)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
This never happened before and I don't know for sure how to correct it.
Answer by Amar1312 · Oct 15, 2019 at 06:48 AM
Hi I was facing same issue. I find the solution . Problem is created due to Google play services. Remove Google play services related plugin and googleplayservice folder too from unity project and re-import all of them again. Its work for me
Your answer
Follow this Question
Related Questions
Gradle error Corrupts apk 0 Answers
Android build failed error 1 Answer
I have a build problem android. 0 Answers
Android version not working as intended 2 Answers