When i build APK find this error. Unity 5.6.7f1. Help please
CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details. D:/ForUnity/AndroidStudio\tools\bin\avdmanager.bat list target -c
stderr[
] stdout[
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the location of your Java installation. ] exit code: 1 UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit) UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSdk.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.HostView:OnGUI()
Answer by Larry-Dietz · Dec 08, 2019 at 04:28 PM
Did you do what the first line in that error said? Verify that you have the correct path to the Android SDK set in the preferences in Unity?
Your answer
![](https://koobas.hobune.stream/wayback/20220612215825im_/https://answers.unity.com/themes/thub/images/avi.jpg)