[OS X] Remember to install the Android SDK via the SDK Manager, not Android Studio.

4. Add the Android SDK path to Unity
The first time you build a project for Android (or if Unity later fails to locate the SDK) you will be asked to locate the folder where you installed the Android SDK (you should select the root folder of the SDK installation). The location of the Android SDK can also be changed in the editor by selecting Unity > Preferences from the menu and then clicking on External Tools in the preferences window.

This is problematic when you have Android Studio installed because the folder uses a .app extension and isn’t treated like a folder and therefore disabled in Unity’s Android SDK location dialog.

This threw me off originally because I installed Android Studio and didn’t realize that this was incorrect. I needed to click “Other Download Options”, download the SDK tools, Open the Android SDK Manager: android-sdk-macosx/tools/android , leave all default options checked and check the Intel extra tool at the bottom of the list, and install. The android-sdk-macosx, or whatever it was renamed to, is the folder I select in the Unity Android SDK dialog and it works now. Just wanted to update this in case others new to Android dev get lost too.

1 Like

Thanks, I’ll forward this to our Android developers for review, and possible update of the documentation.

/Rasmus

Actually, even with Android Studio, the path to the SDK is in /Users/yourname/Library/Android/sdk

So it’s very simple to enter it when Unity asks for it. The only difficulty is that /Users/yourname/Library is always hidden by default, so you can’t access it from within Unity. How to circumvent this problem ? Easy (you might have to correct the real names, as I have OS X in French, so my raw translation might be incorrect in english ) :

1- in the finder’s menu, be sure to have set Presentation/Display Path Bar
2- then, in the finder’s menu, chose go/go to… and type in the requester “/Users/yourname/Library”
3- now, in the path bar, grab the “library” folder and drop it in the “favorite” section of your finder’s window, on the left.
4- when Unity asks for the SDK’s path you can now click on “library” on your favorite places and navigate to Android/sdk

It takes far less time to do than to explain, so I hope it’ll help all those who ran into this problem. I compiled the default (Angry Bots) project that way and it ran perfectly on my Android device.

4 Likes

Thanks! It worked for me!

Im having a problem with unity finding Google play services on mac. I’ve downloaded it using both eclipse and android studio and unity can’t find it with either.

It works !!! Thanks !!!

Thanks for the detailed comments and solutions, all. I’ve added a task for the doc team to update the android SDK manual page to include this information.

I see that the documents have not really been updated accurately yet. It was pretty simple for me to fix my problem though, I just made it so that Library is displayed in Finder and was then able to find /sdk in Unity with no problems.

Step 1. Open Finder
Step 2. Right click.
Step 3. Select View Options
Step 4. Click Show Library Folder
Step 5. Follow the normal instructions for locating the Android SDK

3 Likes

Found this old thread and I had the same problem. One other solution if an Android Studio installation isn’t doing the trick,

  1. go to 下载 Android Studio 和应用工具 - Android 开发者  |  Android Developers,
  2. download the SDK command line tools,
  3. Unzip, should create a “tools” folder where your zip file is/where you downloaded the SDK cmd line tools…
  4. then simply copy them over to the “tools” directory of your Android Studio directory.
    (i.e. /Downloads/tools → /Users/yourusernamehere/Library/Android/sdk/tools)

This worked for me and puts all the cmd tools in the “correct” place for Unity to see…

3 Likes

Mac unity android sdk path setting

=========================

If you have Android Studio installed.

The path for SDK is “/Users/username/Library/Android/sdk”.

But sometimes the “Library” folder is hidden.

To see the hidden files, follow the link: http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/

Or follow the steps below

  • Open Terminal found in Finder > Applications > Utilities
  • In Terminal, paste the following: defaults write com.apple.finder AppleShowAllFiles YES
  • Press return
  • Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock and click Relaunch.

Once you done this. Open unity->Unity->Preferences->External tools

In that find SDK path option, click browse, then drag the “sdk” folder which you just opened above in Finder…

Done…

If its still giving error then consider below case:

Sometimes Unity won’t recognise Android Studio’s sdk tools and gives error and ask you to again set the path.

To solve this, download separate sdk tools from Google.

Link : https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip

Once you download the “tools” folder.

Then copy it and replace it in “/Users/username/Library/Android/sdk”.

And try again…

I know this is not written well…but if you are struggling a lot …if will just give you an correct hint. I struggled a lot for this issue…so wanted to help you all.

Thank you…

2 Likes

I’ve installed SDK and correctly pathed to it in Unity, yet when building Unity still says it cant find it.

Thoughts?

Found solution for my issue on Mac here, Unable to list target platforms. (Cant build into Android) - Questions & Answers - Unity Discussions

The second answer in that thread by user, shrinath-kopare.

Here’s the part from his post that solved the issue for me:

To solve this, download separate sdk tools from Google. Link : https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip
Once you download the “tools” folder. Then copy it and replace it in “/Users/username/Library/Android/sdk”.

1 Like

You can unhide the library directories on mac using “chflags nohidden ~/Library/”. Sadly, I still can’t get an android build working on Mac :frowning:

This also applies for the JDK, which I initially specified to be under “Android Studio.app”
It turns out you need to tell Unity to look under whatever is yielded by running:

/usr/libexec/java_home

See this link for more info on that.

Thanks!!!

this really helped me a lot. I did install android studio in my mac (just to make sure i didnt miss any sdks) and opened unity to check the external tools configured or not. but the error message kept saying that “unable to select sdk in selected directory” . i really checked with the root folder of android studio and couldnt find the “tools” folder in that. now from this post i downloaded the command tools folder and pasted in the root path.
it works like a charm…

Please HELP!

It says: “Failed to extract Android SDK platform version from string “R”. Input string was not in a correct format”

I have android studio on my Mac and I’ve made some Android apps in it and everything worked well. But here in unity it is always showing me this error. Please help me, I’ve done so many things but I can’t figure it out.

fhgsdh