본문 바로가기
잡동/개발환경(개발툴)

Mac에서 Android build를 위한 세팅

by 죠부니 2017. 12. 12.
반응형

문서에서 요구하는 필요한 내용

Java Development Kit (JDK)

Install Java Development Kit (JDK) 8 or later.

When installing on Windows you also need to set JAVA_HOME Environment Variable according to your JDK installation path (see Setting Environment Variables)

Android SDK

Install Android Studio. Detailed installation instructions are on Android's developer site.

Adding SDK Packages

After installing the Android SDK, you must also install the packages for whatever API level you wish to target. It is recommended that you install the highest SDK version that your version of cordova-android supports (see Requirements and Support).

Open the Android SDK Manager (run android or sdkmanager from the terminal) and make sure the following are installed:

  1. Android Platform SDK for your targeted version of Android
  2. Android SDK build-tools version 19.1.0 or higher
  3. Android Support Repository (found under "Extras")

See Android's documentation on Installing SDK Packages for more details.

Setting environment variables

Cordova's CLI tools require some environment variables to be set in order to function correctly. The CLI will attempt to set these variables for you, but in certain cases you may need to set them manually. The following variables should be updated:

  1. Set the JAVA_HOME environment variable to the location of your JDK installation
  2. Set the ANDROID_HOME environment variable to the location of your Android SDK installation
  3. It is also recommended that you add the Android SDK's toolstools/bin, and platform-tools directories to your PATH

OS X and Linux

On a Mac or Linux, you can use a text editor to create or modify the ~/.bash_profile file. To set an environment variable, add a line that uses export like so (substitute the path with your local installation):

export ANDROID_HOME=/Development/android-sdk/

To update your PATH, add a line resembling the following (substitute the paths with your local Android SDK installation's location):

export PATH=${PATH}:/Development/android-sdk/platform-tools:/Development/android-sdk/tools

Reload your terminal to see this change reflected or run the following command:

$ source ~/.bash_profile


1. JDK설치

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

사이트 접속후 macOS버전을 다운로드 받는다.

다운로드후 다음다음다음다음 을 통해 설치한다

설치 당시 버전은 1.8.0_152버전이다

설치완료후 터미널에서 java -version을 통해서 설치확인

자바 환경변수 설정

NVM을 설치하면서 환경변수 파일은 생성되어있다.

커맨드창에서 

open -e .bash_profile

해당 문구를 추가시킨다

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home


2. ANDROID_HOME추가

를 위해서 안드로이드 스튜디오 다운로드 및 설치

https://developer.android.com/studio/index.html


export ANDROID_HOME=/Users/naitas/Library/Android/sdk

export PATH=$PATH:$ANDROID_HOME/sdk/platform-tools:$ANDROID_HOME/sdk/tools

두줄을 .bash_profile에 등록한다

등록후

source ~/.bash_profile

3. Gradle설치

https://gradle.org/

https://gradle.org/releases/

설치일 기준 최신버전은 4.4버전이다

다운로드 받은 파일을 압축을 푼 후

$ mkdir /opt/gradle
$ unzip -d /opt/gradle gradle-4.4-bin.zip
$ ls /opt/gradle/gradle-4.4
LICENSE  NOTICE  bin  getting-started.html  init.d  lib  media

홈페이지에서는 /opt/gradle에 파일을 설치한다.

bash_profile에 해당 PATH를 추가한다

 $ export PATH=$PATH:/opt/gradle/gradle-4.4/bin

source ~/.bash_profile

설치확인 완료



반응형

'잡동 > 개발환경(개발툴)' 카테고리의 다른 글

HP Intelligent Provisioning 재설치  (0) 2017.12.19
Fix error dev/kvm is not found  (0) 2017.12.12
MAC에 Cordova설치  (0) 2017.12.12
MAC에서 Nodejs설치  (0) 2017.12.12
서브라임텍스트3 - MAC OS  (0) 2017.12.07