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.
- Download an older version of the Android SDK tools from the official website. Tools_r25.2.3-windows.zip.
- Back up tools from the original SDK directory. I was renaming it to tools-25.3.1.
- Unzip the old version of tools downloaded to the SDK directory.
- 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