Finding Android SDK on Mac and adding to PATH

前端 未结 7 2084
离开以前
离开以前 2020-12-07 07:28

I have installed Android Studio on my MacBook Air (OS Version 10.11 El Capitan) and have successfully written a small \"hello, world\" app and installed on device (Nexus 7)

相关标签:
7条回答
  • 2020-12-07 08:07

    1. How to find it

    • Open Android studio, go to Android Studio > Preferences
    • Search for sdk
    • Something similar to this (this is a Windows box as you can see) will show

    You can see the location there – most of the time it is:

    /Users/<name>/Library/Android/sdk
    

    2. How to install it, if not there

    • Go to Android standalone SDK download page
    • Download the zip file for macOS
    • Extract it to a directory

    3. How to add it to the path

    Open your Terminal edit your ~/.bash_profile file in nano by typing:

    nano ~/.bash_profile
    

    If you use Zsh, edit ~/.zshrc instead.

    Go to the end of the file and add the directory path to your $PATH:

    export PATH="${HOME}/Library/Android/sdk/tools:${HOME}/Library/Android/sdk/platform-tools:${PATH}"
    
    • Save it by pressing Ctrl+X
    • Restart the Terminal
    • To see if it is working or not, type in the name of any file or binary which are inside the directories that you've added (e.g. adb) and verify it is opened/executed
    0 讨论(0)
  • 2020-12-07 08:07

    Find the Android SDK location

    Android Studio 
      > Preferences
      > Appearance & Behaviour
      > System Settings 
      > Android SDK
      > Android SDK Location
    

    Create a .bash_profile file for your environment variables

    • Open the Terminal app
    • Go to your home directory via cd ~
    • Create the file with touch .bash_profile

    Add the PATH variable to your .bash_profile

    • Open the file via open .bash_profile
    • Add export PATH=$PATH: [your SDK location] /platform-tools to the file and hit ⌘s to save it. By default it's:

      export PATH=$PATH:/Users/yourUserName/Library/Android/sdk/platform-tools

    • Go back to your Terminal App and load the variable with source ~/.bash_profile

    0 讨论(0)
  • 2020-12-07 08:09

    If Android Studio shows you the path /Users/<name>/Library/Android/sdk but you can not find it in your folder, just right-click and select "Show View Option". There you will be able to select "Show Library Folder"; select it and you can access the SDK.

    0 讨论(0)
  • 2020-12-07 08:12

    AndroidStudioFrontScreenI simply double clicked the Android dmg install file that I saved on the hard drive and when the initial screen came up I dragged the icon for Android Studio into the Applications folder, now I know where it is!!! Also when you run it, be sure to right click the Android Studio while on the Dock and select "Options" -> "Keep on Dock". Everything else works. Dr. Roger Webster

    0 讨论(0)
  • 2020-12-07 08:23
    1. How do I find Android SDK on my machine? Or prove to myself it's not there?

    When you install Android studio, it allows you to choose if you want to download SDK or not

    1. If it's not there how do I install it?

    you can get SDK from here http://developer.android.com/sdk/index.html

    1. How do I change PATH to include Android SDK?

    in Android Studio click in File >> Settings

    0 讨论(0)
  • 2020-12-07 08:30

    If you don't want to open Android Studio just to modify your path...

    They live here with a default installation:

    ${HOME}/Library/Android/sdk/tools
    ${HOME}/Library/Android/sdk/platform-tools
    

    Here's what you want to add to your .bashwhatever

    export PATH="${HOME}/Library/Android/sdk/tools:${HOME}/Library/Android/sdk/platform-tools:${PATH}"
    
    0 讨论(0)
提交回复
热议问题