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.
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.
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.
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
Unzip, should create a “tools” folder where your zip file is/where you downloaded the SDK cmd line tools…
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…
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.
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:
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…
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.