Win平台Unity无法正确识别Android SDK的处理
通过官网下载的最新版sdk tools,惊讶地发现自17年3月后,非捆绑Android Studio的sdk下载不再提供GUI版sdk manager,变成了真CLI包。
为了推Android Studio,google你连脸都不要了,mmp不知当讲否
这还不算完事,在jdk和android sdk都折腾完毕后,尝试编译apk收到如下报错:
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_121\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir=“C:/Users/Administrator/AppData/Local/Android/Sdk\tools” -Dfile.encoding=UTF8 -jar “C:\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.HostView:OnGUI()
在确认环境配置没毛病后,疑点转向unity对sdk tools的检查上。鉴于google在这方面老搞事情,不得不考虑是不是应该尝试下老版本tools
先备份tools目录出去,将老版本tools目录替换上,问题解决