Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

Discussion in 'Android' started by Nabren, Mar 1, 2017.

  1. Nabren

    Nabren

    Joined:
    Mar 7, 2014
    Posts:
    61
    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!
     
    bradlaronde likes this.
  2. Nabren

    Nabren

    Joined:
    Mar 7, 2014
    Posts:
    61
    Okay, to downgrade:

    SDK Tools Release Notes: https://developer.android.com/studio/releases/sdk-tools.html
    SDK Platform Tools Release Notes: https://developer.android.com/studio/releases/platforms.html

    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<version>-windows.zip
    https://dl-ssl.google.com/android/repository/tools_r<version>-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<version>-windows.zip
    https://dl-ssl.google.com/android/repository/platform-tools_r<version>-macosx.zip
     
    Last edited: Mar 14, 2017
  3. cminson

    cminson

    Joined:
    Oct 19, 2015
    Posts:
    2
    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?
     
  4. Nabren

    Nabren

    Joined:
    Mar 7, 2014
    Posts:
    61
    For me it worked as soon as I downgraded the tools. What version of the SDK Tools did you downgrade to?
     
  5. cminson

    cminson

    Joined:
    Oct 19, 2015
    Posts:
    2
    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.
     
  6. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    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
     
    Nabren likes this.
  7. rootPL

    rootPL

    Joined:
    Sep 5, 2015
    Posts:
    14
    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.
     
    Nabren likes this.
  8. Nabren

    Nabren

    Joined:
    Mar 7, 2014
    Posts:
    61
    Great suggestion rootPL, done.
     
  9. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    612
    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.
     
    Last edited: Aug 13, 2017
  10. Nicoroots

    Nicoroots

    Joined:
    Apr 21, 2018
    Posts:
    6
    Hi,

    This issue is still not fixed :
    - I'm using Unity2017.3.1f1
    - Tried to download latest version of SDK from https://developer.android.com/studio/ (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

    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".

    Capture.PNG

    - 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 :

    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
     

    Attached Files:

  11. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,978
  12. Nicoroots

    Nicoroots

    Joined:
    Apr 21, 2018
    Posts:
    6
    Yeah I just saw that :) I'm reading the post. Thanks Aleksandrk
     
  13. Nicoroots

    Nicoroots

    Joined:
    Apr 21, 2018
    Posts:
    6
    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