# Why do I get these “Invalid command android” errors trying to build for Android in Unity?

Trying to move a unity project over to android using gradle as the build system. I get the following 3 errors:

Error:Invalid command android

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/joeljohnson/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]
exit code: 64
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()


and

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/joeljohnson/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]


It turns out a lot of people have been having this problem and the most common solution is to move to an earlier version of the apk. When I tried that, I still received the same three errors. I moved down to api level 23 from the most current. I am one a mac. exit code: 64

This is a known bug. It's been fixed in the latest version of Unity:

5.4.5p2 and higher
5.5.3p3 and higher
5.6.0p3 and higher
and 2017.1 beta 5 and higher

Android: Fixed android application building with the latest android sdk.

• I'm running Unity 5.6.0f3, still getting the errors... – Joel J. Jun 19 '17 at 17:04
• You might try reinstalling. I recently went recorded a course that used Unity + Android. I saw the same error you're seeing back in early May. But the error was no longer present in the latest version of Unity two weeks ago. The SDK removed the android command and Unity was still trying to use it. It's been fixed now. – MichaelHouse Jun 19 '17 at 17:05
• @JoelJ. I've had some issues with 5.6 in the last few weeks. All of them related to HoloLens development (where everything works fine on 5.5), but I wouldn't be surprised if some other oddities snuck in related to other platforms. I just haven't experienced them. As such I've kind of mentally marked 5.6 as an "unstable beta" rather than the "next major release" as it should have been. – Draco18s Jun 19 '17 at 18:19
• @JoelJ. I checked, looks like the patched version for 5.6 is 5.6.0p3. Just try downloading the latest 5.6 since your installed version may not be included (Even though it kind of seems like it, I'm not sure if 5.6.0f3 contains 5.6.0p3). – MichaelHouse Jun 19 '17 at 18:48
• @Byte56 I updated unity. The problem's solved now..thx – Joel J. Jun 19 '17 at 18:56