I cannot build to android Unity 2017.1.1f1 (Unable to List Target Platforms)

I have tried using Unity 5.6, Unity 2017 1.1f1, and the Unity Beta 2017.2.0f2 and I get the same error each time. I have the latest Android Studio, SDK, Java JDK, and Win 10. I have the correct paths in Unity that lead to the SDK and JDK. Everything in the program works perfectly, testing is done, I’m ready to market, and, yes, I’ve even done this before. But I cannot build my apk due to this system error.

Traditionally, this error is caused by a clash between Android Studio Tools and Unity. I have tried all the known workarounds that I can find (installing older versions of SDK Tools, older versions of Unity, beta versions of Unity, etc). I’ve been reading the manual, the forums, and the many workaround solutions.
I’ve been swapping files and reinstalling everything for the last couple days and I just cannot get beyond this. The old workarounds are not working for me.

Does anyone know a way around this? Nothing theoretical, I want the Unity and Android Studio version pair that are actually allowing you to build right now. If you have a working Unity-AndroidStudio pair, I can, at least, figure out if it is just me or not.

Thanks!

Error follows:
CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
D:/Java/jdk-9\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir=“D:/Android/sdk ools” -Dfile.encoding=UTF8 -jar “D:\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.
D:/Java/jdk-9\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir=“D:/Android/sdk ools” -Dfile.encoding=UTF8 -jar “D:\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar” -

stderr[
Error:Invalid command android
]
stdout[

]
exit code: 64

UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
UnityEditor.HostView:OnGUI()

First thing download and install JDK version 8 if you don’t have it and set it as your jdk on unity (jdk path after installation is usually C:/Program Files/Java/jdk):

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Then download and extract this file:

https://dl.google.com/android/repository/tools_r25.2.3-windows.zip?hl=id

Inside you will find a folder called “tools”, cut it.

Now go to the location where your sdk is located, usually the path is C:\Users"username"\AppData\Local\Android\sdk (AppData is a hidden folder, make sure your system settings allow you to see hidden folders).

Now that you are inside the sdk folder, you will see a folder named “tools”. Rename it as “tools_OLD”.

Last but not least, paste here the “tools” folder that you have cut earlier.

This should work.

In the end, i used Unity 2017.1.1f1 and the latest Android SDK, but had to use an older Java JDK (#8, not #9) to make it work. I did not need to change the tools files or anything like that, I used the latest as-downloaded, off-the-shelf versions of both Unity and Android SDK with the old Java JDK 8.

I tried the above solution , but it didn’t worked in my case

Having similar issues. jdf version 8 . did the “tools” swap. works now. so frustrating!