"안드로이드 개발환경 구축 (따로 설치)"의 두 판 사이의 차이

24번째 줄: 24번째 줄:
===Android SDK===
===Android SDK===
*http://developer.android.com/sdk/index.html 접속
*http://developer.android.com/sdk/index.html 접속
*[Download the SDK, ADT Bundle for Windows] 클릭하여 adt-bundle-windows-x86_64.zip(398MB) 다운로드
*[Download the SDK, ADT Bundle for Windows] 클릭
*"Get the Android SDK" --- [V] I have read and agree with the above terms and conditions
*(O) 64-bit --- [Download the SDK ADT Bundle for Windows] 클릭하여 adt-bundle-windows-x86_64.zip(398MB) 다운로드 시작


===Eclipse===
===Eclipse===

2012년 12월 10일 (월) 12:53 판

안드로이드 개발환경 구축
안드로이드 앱 개발환경 구성
안드로이드 Hello World

1 개요

절차는 다음과 같다.

  • JDK 설치
  • Android SDK 설치
  • Eclipse + ADT 설치
  • ADT와 Android SDK를 연결
  • 시뮬레이터(AVD) 테스트
  • Hello World 테스트

2 다운로드

2.1 JDK

JavaDK 다운로드.png

  • (O) Accpet License Agreement
  • [jdk-7u5-windows-xxxx.exe] 클릭
32비트 윈도우라면 jdk-7u5-windows-i586.exe
64비트 윈도우라면 jdk-7u5-windows-x64.exe

2.2 Android SDK

  • http://developer.android.com/sdk/index.html 접속
  • [Download the SDK, ADT Bundle for Windows] 클릭
  • "Get the Android SDK" --- [V] I have read and agree with the above terms and conditions
  • (O) 64-bit --- [Download the SDK ADT Bundle for Windows] 클릭하여 adt-bundle-windows-x86_64.zip(398MB) 다운로드 시작

2.3 Eclipse

자신의 윈도우 비트 종류에 맞는 것 클릭
  • 화살표 그림 클릭하여 다운로드

이클립스 다운로드.png

3 설치

3.1 JDK

  • jdk-7u5-windows-i586.exe 실행
  • "Welcome to ..." --- Next >
  • "Select optional features"[1] --- Next >
  • "Install to:"[2] --- Next >
  • "Java SE Development Kit ... Installed" --- Continue
  • "JavaFX SDK Setup" --- Cancel[3]
  • "Are you sure you want to cancel JavaFX Setup?" --- 예(Y)
  • 사용자 등록 웹페이지가 자동으로 열리는데 닫아준다.

3.2 Android SDK

  • installer_r18-windows.exe 실행
  • "Welcome ..." --- Next >
  • "Java SE Development Kit" --- Next >
  • "Choose Install Location" --- Next >
  • "Choose Start Menu Folder" --- Install
  • "Installation Complete" --- Next
  • "Completing ..." --- Finish
Android SDK Manager
  • "Android SDK Manager" --- Install 9 packages...
  • "Choose Packages to Install" --- (O) Accept All --- Install
  • "Downloading Android SDK Platform-tools ..."
  • "Android SDK Manger Log" "Stopping ADB server failed (code -1)." --- Close
  • 다운로드 계속 (오래 걸린다...)
  • "Android Tools Updated" --- OK

3.3 Eclipse

  • eclipse-jee-indigo-SR2-win32.zip 파일 압축해제
  • eclipse 폴더를 D:\Portable로 이동

3.4 Eclipse에 ADT 설치

  • eclipse 폴더 내의 eclipse.exe 실행
  • "Select a workspace" --- Workspace: D:\workspace\eclipse --- [V] Use this as the default ... --- OK
  • Welcome 탭 닫기
  • Help --- Install New Software...
  • "Available Software" --- Add...
  • "Add Repository" --- Name: Android Plugin --- Location: https://dl-ssl.google.com/android/eclipse/ --- OK
  • 목록에 Pending이 뜨는데 기다리면 Developer Tools로 바뀐다.
  • 모두 선택한 후 --- Next >

Eclipse Available Software.png

  • "Install Details" --- Next >
  • "Review Licenses" --- (O) I accept the terms of the license agreements --- Finish
  • "Installing Software" --- "Security Warning" --- OK
  • "You will need to restart Eclipse ..." --- Restart Now

4 설정

4.1 ADT에 안드로이드 SDK 연동

앞에서 SDK를 설치했으므로 연결만 해주면 된다.

  • Welcome to Android Development" --- (O) Use existing SDKs --- Browse... --- C:\Program Files\Android\android-sdk 선택 --- 확인 --- Next >
  • "Contribute Usage Statistics?" --- Finish

4.2 AVD Manger 설정 및 테스트

Eclipse에서

  • Window --- AVD Manager
  • "Android Virtual Device Manager" --- New...
  • Name: A_4.0.3_800 --- Target: Android 4.0.3 - API Level 15 --- CPU: Intel Atom (x86) --- Create AVD
  • 목록에서 방금 생성된 AVD명 "A_4.0.3_800"를 선택 --- Start...
  • "Launch Options" --- Launch

검은 화면이 뜨고 잠시 기다리면 ANDROID 로고가 나온다. 계속 기다리면 시계가 뜨고, 바탕 화면이 나타난다.

  • 시뮬레이터 창 닫기
  • AVD Manager 창 닫기

4.3 Eclipse 설정

  • Window --- Preferences
  • General --- Editors --- Text Editors --- [V] Show line numbers --- Apply
  • General --- Workspace --- "Text file encoding" --- (O) Other: UTF-8 --- Apply --- OK

5 Hello World

5.1 기본

  • File --- New --- Other...
  • "Select a wizard" --- Android --- Android Project --- Next >
  • Project Name: Hello --- Next >
  • "Select Build Target"[4] --- Next >
  • "Application Info" --- Package Name: "com.example.hello" --- Finish
  • 왼쪽 Package Explorer에서 Hello 클릭
  • Ctrl+F11 입력(실행)
  • "Run As" --- Android Application 클릭 --- OK
  • 시뮬레이터가 실행되고 ANDROID 로고가 나온다.
  • 그리고 계속 기다리면 "Hello World, HelloActivity!"가 뜬다.[5]

5.2 변형

위에서는 소스코드를 직접 건드린 부분이 하나도 없다. 이번에는 소스코드를 수정해보자.

  • Package Explorer --- Hello --- src --- com.example.hello --- HelloActivity.java 더블클릭

오른쪽 메인 창에 HelloActivity.java 내용이 나온다.

package com.example.hello;

import android.app.Activity;
import android.os.Bundle;

public class HelloActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

이것을 다음과 같이 수정하자.

package com.example.hello;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView; //추가

public class HelloActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);

        TextView tv = new TextView(this);
        tv.setText("안녕, 친구들");
        setContentView(tv);
    }
}
  • Ctrl+F11 입력하여 실행
  • "안녕, 친구들"이 출력되면 성공.

6 같이 보기

7 주석

  1. JDK 설치위치(기본값): C:\Program Files\Java\jdk1.7.0_04\
  2. JRE 설치위치(기본값): C:\Program Files\Java\jre7\
  3. JavaFX SDK는 안드로이드 개발환경과는 무관. 다른 이유로 필요하다면 설치하시라.
  4. Android 4.0.3과 Google APIs이 있으며 Android 4.0.3만 선택되어 있다
  5. 만약 잠겨 있다면 잠금을 풀자.

8 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}