Unity cannot find the ANDROIDSDK problem at compile time | Unable to list target platforms

Source: Internet
Author: User
Tags deprecated

Turn from: Http://www.jianshu.com/p/fe4c334ee9fe phenomenon

The unable to list target platforms was encountered while compiling the Android platform app with Unity.


Error hints

Detailed error descriptions are as follows:

Error:invalid Command Android
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

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_91\bin\java.exe-xmx2048m-dcom.android.sdkmanager.toolsdir= "D:/Android/sdk\tools" -dfile.encoding=utf8-jar "D:\Program Files\unity\editor\data\playbackengines\androidplayer/tools\sdktools.jar"-

stderr[
Error:invalid Command Android
]
stdout[

]
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.BuildPlayerWindow:BuildPlayerAndRun ()

Reason reason simple description

Unity will invoke Android commands in Android SDK tools at compile time, and in the new version of Android SDK tools, the Android command is deprecated, causing unity to fail to compile properly. My Android SDK tools version is 25.3.1.

The process of finding the cause of the problem

After repeated confirmation, I configured the Android SDK is no problem.


SDK settings


Later I noticed that the error description mentioned "Invalid command Android", so I tried to call Android directly to see if there was a problem.

Error:invalid Command Android

Android commands are android.bat in the ANDROIDSDK tools directory. Direct call, found that this command 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.bat and Tools\bin\avdmanager.bat

Solution Solutions

Knowing the reason, the problem is solved.

    1. Download an older version of the Android SDK tools from the official website. Tools_r25.2.3-windows.zip.
    2. Back up tools from the original SDK directory. I was renaming it to tools-25.3.1.
    3. Unzip the old version of tools downloaded to the SDK directory.
    4. Re-compiling in Unity, the problem has been resolved.

Comparing the two versions of tools, the difference is really big and a lot less. For example, do. 9 figure of Draw9patch don't know where to go.

Unity compiler cannot find ANDROIDSDK problem | Unable to list target platforms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.