AndroidSDK cannot be found during Unity compilation | Unable to list target platforms (reprinted), unityengine. ui cannot be found
Original article: http://www.jianshu.com/p/fe4c334ee9fesymptom
When compiling Android applications with Unity, you may encounter the problem of Unable to list target platforms.
Error Message
Detailed error description:
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()
Brief description of the cause
Unity will call the Android command in android SDK tools during compilation. In the new version of Android SDK tools, the android command has been discarded, and Unity cannot be compiled normally. My Android SDK tools version is 25.3.1.
Process of finding the cause
After repeated confirmation, the Android sdk I configured is okay.
SDK settings
Later, I noticed that "invalid android command" was mentioned in the error description, so I tried to directly call the android command to see if there was any problem.
Error:Invalid command android
The android command is android. bat in the tools directory of AndroidSDK. You can call this command directly and find that the command has been discarded.
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
If you know the cause, the problem will be solved.
Compared with the tools of the two versions, the difference is really great, and a lot is missing. For example, the draw9patch of the. 9 graph does not know where to go.