Unable to list target platforms. I tried so many things based on other such posts but nothing changes!
I know this happens to many people and I keep trying what they did or the suggestions but here goes.
Android build on Windows 10 64 bit with unity 5.6.1f1.
Pop-up message when building:
"Unable to list target platforms. Please make sure the android sdk path is correct. See the console for more details. See the console for more details."
Then in the console 3 error messages (marked with for readability): - Error:Invalid command android
UnityEditor.HostView:OnGUI()
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/jdk-9.0.1\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[ Error:Invalid command android ] stdout[
] exit code: 64 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()
Error building Player: 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/jdk-9.0.1\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[ Error:Invalid command android ] stdout[
] exit code: 64
Now the things I have tried:
1) Update unity to version that is supposed to fix this. (Now I am on 5.6.1f1) 2) Install both 32 and 64 bit version of JDK. 3) I fully installed Android Studio and downloaded pretty much everything in their sdkmanager. 4) Changed the sdk location outside of the user/appdata/local/etc since it is a hidden folder (eventhough I unhid it) since I feared it might interrupt the process somehow. Now the SDK location is just in c:/ and ofcourse update the path in Unity (which finds it because if I select the wrong folder on purpose it won't close the the little pop-up browser) 5) Tried various versions of the command line tools since some people said that would help. 6) Many other random things that I can't even remember.
I've lost already 3 days on this. My project needs to go on. This is the first thing in a good 6 months I really got stuck where I can't reason my way out of it. All of the solutions are things that have worked for other people but nothing changes in mine.
Any help would really be appreciated!
Cheers,
Daan
Having the same problem, please help! I also tried everything... This is insanity, I spent more than 3 days trying to fix it.
Still struggeling, Siarhei. Will post if/when I fix it! I am just continueing my project and waiting for the golden tip. If nothing arrives I will just try to switch platform (windows --> mac). $$anonymous$$aybe the fix will be easier...
Answer by shubham-j · Oct 27, 2017 at 09:30 PM
Did you try downloading just the SDK and replacing the tools folder?
You mean downloading the command line tools alone? That is what I did first and since that gave the same error as the one listed above. Since then I Installed the full android studio, changed the command line tools version a few times, updated Unity, changed the SD$$anonymous$$ location, tried different versions of JD$$anonymous$$ and other stuff I can't remember. None of it worked.
Yes. But replace just the 'tools' folder in your SD$$anonymous$$ folder by the tools folder in the command line only download. That worked for me.
Also, what JD$$anonymous$$ are you using? I downgraded $$anonymous$$e from 9 to 8, and that worked.
Shubham, thanks for your advice but tried it already. Gave it another go out of desperation but to no avail...
Your answer
Follow this Question
Related Questions
Android app not building after switching to il2cpp 0 Answers
[Android VR app build error] CommandInvokationFailure: Gradle build failed. 0 Answers
Temp\gradleOut\launcher\build\outputs\bundle\release\launcher-release.aab does not exist 0 Answers
Unity says that I'm missing my NDK and SDK libraries, but I have them installed via Unity hub? 1 Answer
Facebook SDK integration in Unity 2018 0 Answers