development

Mac에서 Android SDK 찾기 및 PATH 추가

big-blog 2020. 5. 27. 08:11
반응형

Mac에서 Android SDK 찾기 및 PATH 추가


MacBook Air (OS 버전 10.11 El Capitan)에 Android Studio를 설치했으며 작은 "hello, world"앱을 작성하고 장치 (Nexus 7)에 설치하고 AVD에서 실행했습니다. 내가하고 싶은 일은 Android Studio와 달리 명령 줄에서 앱을 빌드하고 장치에 설치할 수 있다는 것입니다. 나는 여기의 지시를 따르고 있습니다 :

http://developer.android.com/training/basics/firstapp/running-app.html

관련 줄은 다음과 같습니다.

Android SDK platform-tools / 디렉토리가 PATH 환경 변수에 포함되어 있는지 확인한 후 다음을 실행하십시오.

문제는 내 컴퓨터에서 Android SDK를 찾을 수 없다는 것입니다! 그렇지 않으면 프로그램이 Android Studio를 통해 컴파일되고 실행되지 않기 때문에 거기에 있다고 가정합니까? 아마도 그것은 나쁜 가정입니까? Mac에 익숙하지 않아 (Windows에 익숙 함) Android SDK를 검색하는 가장 좋은 방법을 모릅니다. 그래서 내 질문 :

  1. 컴퓨터에서 Android SDK를 어떻게 찾습니까? 아니면 거기에 없다고 스스로에게 증명합니까?
  2. 없는 경우 어떻게 설치합니까?
  3. Android SDK를 포함하도록 PATH를 어떻게 변경합니까?

1. 찾는 방법

Android 스튜디오를 열고 Goto Android Studio> 환경 설정 SDK를 검색하십시오. 이와 비슷한 것이 표시됩니다 (이것은 볼 수있는 창 상자입니다)MAC 팬이 아니라 죄송합니다

대부분의 경우 위치를 볼 수 있습니다. /Users/<name>/Library/Android/sdk

2. 설치 방법 (없는 경우)

Just go-to Android Standalone sdk download page , download the zip file for OSX and extract it to a directory 독립형 SDK 다운로드 페이지

3. How to add it to the path

Open your terminal application and open paths file in nano by typing

sudo nano /etc/paths

Input your password,Go to the end of the lines and input the directory path. And you want to add: eg:-

/Users/username/Libs/android-sdk-mac_x86/platform-tools

나노 스크린 샷

Save it by pressing Ctrl+X, Restart the terminal application and 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 and verify it is opened/executed


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}"

  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 여기에 이미지 설명을 입력하십시오


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


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.


The default path of Android SDK is /Users/<username>/Library/Android/sdk, you can refer to this post.

add this to your .bash_profile to add the environment variable

export PATH="/Users/<username>/Library/Android/sdk/tools:/Users/<username>/Library/Android/sdk/build-tools:${PATH}"

Then save the file.

load it

source ./.bash_profile 

AndroidStudioFrontScreen 하드 드라이브에 저장 한 Android dmg 설치 파일을 두 번 클릭하기 만하면 초기 화면이 나타나면 Android Studio 아이콘을 Applications 폴더로 끌어서 놓았습니다. 또한 실행할 때 Dock에서 Android Studio를 마우스 오른쪽 버튼으로 클릭하고 "옵션"-> "Keep on Dock"을 선택하십시오. 다른 모든 것이 작동합니다. 로저 웹스터 박사

참고 URL : https://stackoverflow.com/questions/34532063/finding-android-sdk-on-mac-and-adding-to-path

반응형