CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
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()
更新了安卓SDK的tools之后发现打安卓包报如上述错误。google之后发现新的tools中android命令不能使用。
解决方案是去下载老版本的tools替换之后重新打包就可以解决。tools在SDK根目录下。实验发现25.2.3版本及以下都可以正常打包。
下载地址 SDK Tools r24.1.2版本的下载路径是:http://dl.google.com/android/android-sdk_r24.1.2-windows.zip
将r24.1.2修改为 想要的版本后即可下载。下载完把压缩包中的tools单独拉出来替换自己SDK根目录下的tools。(最好把自己的tools备份一下免得以后要用)。
原创链接:http://blog.csdn.net/liu442620190/article/details/77155540?locationNum=8&fps=1