Problems getting the Android SDK to work for Unity?

So, I discovered some problems with building for the Android phone in unity, and it turns out I was not the only one.

The problem came when I tried to build for Android – the buildproduct was interupted by a Build failure

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

And the consol say somehting like this

C:\Program Files\Java\jdk1.7.0_45\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/csb/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar"

This appears to be a mismatch between Unity and the Android SDK, and reverting to an older version of the Android SDK should apperently solve this problem. However, as described in this thread over at Unity Answers – there is an “easy” solution to this problem.

To quote Bigpumkin :

  1. just open https://developer.android.com/studio/index.html
  2. scroll down to the bottom of that page
  3. go to downloads
  4. scroll down to the bottom of that page
  5. find Windows “tools_r25.2.3-windows.zip” download and unzip it
  6. remove and replace the folder tools your SDK (the one that looks like the image below)
  7. enjoy

Thank you for your awesome solution to this problem Bigpumkin

In the end, I have prepared a few pointers on issues that for some reason I experience and forget how to solve. Part of the reason why I get confused, is because of bad error messages from Unity.

  1. When installing the Android SDK – make sure that there is no “space” or special characters in the installpath. The default install location will not work, you have to set it manually.
  2. Remeber to set the path of the Android SDK “Edit -> Preferences -> External Tool”
  3. Remember to set the password for the keystore “Edit -> Project Setting -> Player -> Publishing Settings”
  4. If you are using different computers to build the Android – remember to set the correct path to the keystore (This changes if you commit the changes on different computers) “Edit -> Project Setting -> Player -> Publishing Settings”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.