[Solved] Android command deprecated, error: Unable to list target platforms

As of today, I just found out that if you install the Android SDK fresh or update the Android SDK, it appears the command “android” has been deprecated:

The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager

This prevents Unity from being able to build Android due to the following 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.
Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.

I am currently trying to find a workaround, but likely it’s going to involve downgrading the SDK tools until Unity supports the new version. I will update here with instructions on how to downgrade when I figure it out, haha!

1 Like

Okay, to downgrade:

SDK Tools Release Notes: SDK Tools release notes  |  Android Studio  |  Android Developers
SDK Platform Tools Release Notes: SDK Platform release notes  |  Android Studio  |  Android Developers

To download a manual version of SDK Tools, fill in the following url with a version from the above:

https://dl-ssl.google.com/android/repository/tools_r-windows.zip
https://dl-ssl.google.com/android/repository/tools_r-macosx.zip

For me downgrading to https://dl-ssl.google.com/android/repository/tools_r25.2.5-macosx.zip worked just fine. Once you download an older version the tools, just rename the tools directory at your Android SDK install and replace with the downloaded version.

I didn’t need to downgrade Platform Tools, but if you need to, here are those links as well:

https://dl-ssl.google.com/android/repository/platform-tools_r-windows.zip
https://dl-ssl.google.com/android/repository/platform-tools_r-macosx.zip

5 Likes

Thanks, I hit the same problem. Downgrading fixed it. Such are the travails when dealing with updates.

However: after switching out the SDK Tools folder, I now get the dreaded “CommandInvocationFailure: Failed to build APK”.

All paths are correct. Package name set, API level set to 24. I’m on Unity 5.6b11. Not sure what else to look at.

Anyone else hit this problem?

For me it worked as soon as I downgraded the tools. What version of the SDK Tools did you downgrade to?

I downgraded to the version you did (as posted above) - r25.2.5.

I suspect the issue is that I’m using the Unity Beta and that there’s a temporary incompatibility. The beta is unfortunately required for my purposes, as I’m working with the daydream headset.

Thanks for the Mac Tools folder link, was looking everywhere for it, everyones posts about the problem only mentioned and linked to windows stuff XD

Fix works for me :

  • Android Studio 2.3
  • Renamed tools folder to tools2
  • pasted the above link tools folder there
1 Like

Please consider renaming this topic to:
[Solved] Android command deprecated, error: Unable to list target platforms
I was looking 2 days for the solution of:
“Unable to list target platforms”, now after I found the solution I see this is already solved here.

1 Like

Great suggestion rootPL, done.

STILL NOT FIXED IN LATEST UNITY

I installed fresh android studio with latest SDK’s,
I installed fresh JAVA JDK
Tried 2017.1 and patch 3

building EMPTY SCENE:
CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
C:\Program Files\Java\jdk1.8.0_144\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir=“C:\Users\PEP\AppData\Local\Android\sdk\tools” -Dfile.encoding=UTF8 -jar “C:\Program Files\Unity20171p3\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar” -

the 25.2.3 fix worked for me.

Hi,

This issue is still not fixed :

  • I’m using Unity2017.3.1f1
  • Tried to download latest version of SDK from Download Android Studio & App Tools - Android Developers (the command lines tool)
  • Once on my computer, tried to launch the SDK manager using “sdkmanager.bat”, “android.bat”, “avdmanager.bat” > all of them fail and give me an error message

3580176--289405--Sans titre.png

  • So I installed Android Studio. From there, I could access the SDK manager and installed SDK Platforms API28 which is “Partially installed” for some reasons. I DID click on “Show Package details” and installed all the remaining package > it’s still mentioned as “Partially installed”.

  • In “SDK tool”, I installed the “Google USB driver”
  • Of course, I installed the latest JDK version (jdk-10.0.2) and put the path in Unity

Here are my 2 paths :
SDK : C:/Users/Nicoroots/AppData/Local/Android/Sdk
JDK : C:/Program Files/Java/jdk-10.0.2

I am able to visualize my game on my Android device, but when it comes to building it, I have the same issue :

3580176--289407--Error.png

And the console says :
"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.
Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details."

Which version of SDK are you guys using, I’m completely lost here. Seems I’m missing something, but I can’t tell what exactly ? Anyone could give me a hand please ? I’m using Windows 8.1

Thanks

Unity works with JDK 8. Versions 9 and 10 are not supported.
See the first pinned post in Android forum: https://discussions.unity.com/t/679322

Yeah I just saw that :slight_smile: I’m reading the post. Thanks Aleksandrk

So, I eventually sorted it out and fixed it.
I had to uninstall JDK 10 and installed 8 instead.
(I DID try to install 8 first and change the path, but Unity would not build my game.)
So this made the job.

One thing though for Unity people : Perhaps you should implement an error message in the console and/or even a warning while in the “build setting” Window, saying something like “Eh guys, please keep in mind that JDK 9+ is not compatible with Unity at the moment, we are working on it, etc…”

That would be very appreciated, I think… and would save a lot of time.

Thanks