Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

Discussion in 'Documentation' started by banzai777, Dec 31, 2014.

  1. banzai777

    banzai777

    Joined:
    Apr 27, 2013
    Posts:
    17
    http://docs.unity3d.com/Manual/android-sdksetup.html

    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.
     
    Last edited: Dec 31, 2014
    gdp2 likes this.
  2. Rasmus Selsmark

    Rasmus Selsmark

    Joined:
    Mar 13, 2013
    Posts:
    120
    Thanks, I'll forward this to our Android developers for review, and possible update of the documentation.

    /Rasmus
     
  3. Julien_Nantes

    Julien_Nantes

    Joined:
    Jan 14, 2015
    Posts:
    1
    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. Conferno

    Conferno

    Joined:
    Feb 27, 2014
    Posts:
    46
    Thanks! It worked for me!
     
  5. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    581
    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.
     
  6. huloo

    huloo

    Joined:
    May 2, 2015
    Posts:
    4
    It works !!! Thanks !!!
     
  7. duck

    duck

    Unity Technologies

    Joined:
    Oct 21, 2008
    Posts:
    356
    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.
     
  8. Mosy

    Mosy

    Joined:
    Aug 13, 2014
    Posts:
    24
    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
     
    Aestial, stella23 and jrobertomar like this.
  9. teepeepro

    teepeepro

    Joined:
    Oct 20, 2016
    Posts:
    2
    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 https://developer.android.com/studio/index.html#downloads,
    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...
     
  10. shrinath-kopare

    shrinath-kopare

    Joined:
    Feb 11, 2017
    Posts:
    5
    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…
     
    meghs91 likes this.
  11. viciousesque

    viciousesque

    Joined:
    Oct 4, 2014
    Posts:
    34
    I've installed SDK and correctly pathed to it in Unity, yet when building Unity still says it cant find it.

    Thoughts?

    screencap_sdk.png
     
  12. viciousesque

    viciousesque

    Joined:
    Oct 4, 2014
    Posts:
    34
    Found solution for my issue on Mac here, http://answers.unity3d.com/questions/1280198/unable-to-list-target-platforms-cant-build-into-an.html

    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”.
     
    Korial likes this.
  13. alecmce

    alecmce

    Joined:
    Jun 27, 2017
    Posts:
    1
    You can unhide the library directories on mac using "chflags nohidden ~/Library/". Sadly, I still can't get an android build working on Mac :(
     
  14. gdp2

    gdp2

    Joined:
    Dec 6, 2016
    Posts:
    25
    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:

    Code (CSharp):
    1. /usr/libexec/java_home
    See this link for more info on that.
     
  15. marcn_z

    marcn_z

    Joined:
    Mar 16, 2018
    Posts:
    1
    Thanks!!!
     
  16. akashjohny02

    akashjohny02

    Joined:
    Mar 30, 2020
    Posts:
    3
    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..
     
  17. joaoruirego2

    joaoruirego2

    Joined:
    Aug 28, 2019
    Posts:
    22
    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.
     
    Last edited: Apr 9, 2020
unityunity