Android build CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.

After an update of the latest versions of Android SDK it start to throw an error while trying to build an android app. Here is the stacktrace:

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/hardartcore/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]
exit code: 64

and

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/hardartcore/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/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()

Upgrading to the latest does not work; that’s what caused my problem :slight_smile: They removed a feature and called it “Deprecated” without any warnings (this is not deprecation, it’s removal).

The fix is to rename the “Tools” directory in the Android SDK.

Go to Unity, got to Edit->Preferences, then “External Tools”

Note where the Android SDK is located.

Go there, and rename the “Tools” folder to Tools-XXXX (replace XXX with version, or just call it Tools-Old). This is so you have a backup. You could just delete the folder.

Then, download this file:

http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip

Unzip it to the “Android SDK” location you found in the first step. Make sure it’s “Tools”.

Then, exit and reload Unity - build. It should work.

Also, thanks to @Vladimir-Niakhai, the MacOS version is at:

and look for “tools_r25.2.3-macosx.zip”

Credit to this thread on stack overflow:
http://stackoverflow.com/questions/42538433/not-finding-android-sdk-unity
and
https://code.google.com/p/android/issues/detail?id=235455#makechanges

== John ==

Any solution for this on Mac OSX?

I fixed this problem by going into Android Studio, Uninstalling SDK Build tools, restarting Android Studio and upgrading to the latest build tools.

I am having the same problem. I’m using Unity 5.6f3 and trying to build with the latest SDK (Android 7.1.1), on windows 10.

I’ve tried @jgwinner’s suggestion of replacing the ‘tools’ folder in the android SDK with the one from:
http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip

Still same error.

I have also tried @Knertified’s suggestion of uninstalling and reinstalling the SDK Tools with Android Studio’s SDK Manager. Still the same error.

Are you all succeeding in building with Unity 5.6f3 for Android now?
What exact version of the SDK are you using and where did you get it (from a link, or using the Android Studio SDK Manager?)

I am having the same problem. I’m using Unity 5.6f3 and trying to build with the latest SDK (Android 7.1.1), on windows 10.

I’ve tried @jgwinner’s suggestion of replacing the ‘tools’ folder in the android SDK with the one from: http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip

Still same error.

I have also tried @Knertified’s suggestion of uninstalling and reinstalling the SDK Tools with Android Studio’s SDK Manager. Still the same error.

Are you all succeeding in building with Unity 5.6f3 for Android now? What exact version of the SDK are you using and where did you get it (from a link, or using the Android Studio SDK Manager?)

thanks …very … much.

[99080-sdkmanager.zip|99080]

Problem is changes in Android/sdk/tools/lib folder. Unity sdktools.jar search sdkmanager.jar, but now android uses com.android.sdklib.tool.AvdManagerCli. I wrote simple wrapper (in attachment), that proxies calls from unity to AvdManagerCli. Unpack jar file and put it into Android/sdk/tools/lib folder (in latest build-tools this file not exist).

@jgwinner
Thanks for the help you’ve indicated in your thread so far. I have downloaded Unity 2017.1 and I’m trying to load a build from Unity onto my S8 but Unity doesn’t recognize my phone during the build and therefore won’t push the build to my phone. However, my PC does recognize my phone and it shows up fine in the adb device list and in the device manager. I tried to build a cube object in Unity 5.6 and your http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip files worked, it helped recognize my phone and I was able to push the cube to my phone. The problem is that my original build, the one with my entire scene with tree and eagle assets, was developed in 2017.1 and when I tried to build it in 5.6 there were too many errors. I then tried to re-install 2017.1 and run my complete build with your files but Unity still wasn’t able to recognize my phone during the build. Any suggestions. I’ve spent 14 with my programmer trying to figure out solutions to this problem where Unity 2017.1 just doesn’t recognize my phone during our builds, no matter what we do. I would really appreciate your help :slight_smile: email: beginnersminds@gmail.com :slight_smile:

i have integrated firebase analytics and from that time i am facing this issue whenever i try to build i get this error.
Please help :frowning:

Error: [Temp\StagingArea\AndroidManifest-main.xml:16,Temp\StagingArea\android-libraries\com.google.android.gms.play-services-basement-12.0.1\AndroidManifest.xml:6] Trying to merge incompatible /manifest/application/meta-data[@name=com.google.android.gms.version] element:

UnityEditor.HostView:OnGUI()

In me case that error was removed by running Unity with admin privileges.

However, then happened some other errors caused mainly by Gradle not being satisfied with currently installed SDK. It wanted to install the newest one, but couldn’t do that for some reason (I gave up after several hours of struggle).

Finally I’ve fixed all the problems when I changed build system to “Internal”. It’s marked as deprecated, but it worked without any issue on the first attempt.