Running Your App 앱 가동하기
This lesson teaches you to
You should also read
· Managing AVDs with AVD Manager
If you followed the previous lesson to create an Android project, it includes a default set of
"Hello World" source files that allow you to immediately run the app.
이전 단원에서 안드로이드 프로젝트 생성에 관하여 배운 경우, 바로 app을 실행할 수 있도록 "Hello World" 소스 파일 기본 세트가 포함되어 있습니다.
How you run your app depends on two things: whether you have a real device
running Android and whether you're using Android Studio. This lesson shows you
how to install and run your app on a real device and on the Android emulator,
and in both cases with either Android Studio or the command line tools.
앱 가동 방법은 다음 2가지가 있습니다: 안드로이드를 실행을 위한 실제 장비와 안드로이드 스튜디오. 이 단원에서는 실제 장비와 안드로이드 에뮬레이터에 앱을 설치하고 실행하는 방법, 그리고 두 경우에 안드로이드 스튜디오 또는 명령줄 도구
Run on a Real Device 실제 장비에서 가동시키기
If you have a device running Android, here's how to
install and run your app.
안드로이드가 가동되는 장비를 갖고 있다면 앱을 설치하고 가동시키는 방법이 여기 있습니다.
Set up your device 장비 설정하기
1.
Plug in your device
to your development machine with a USB cable. If you're developing on Windows,
you might need to install the appropriate USB driver for your device. For help
installing drivers, see the OEM USB Drivers document.
USB 케이블을 사용하여 장치를 개발 머신에 연결합니다. Windows에서 개발하는 경우에, 장치에 적합한 USB 드라이버를 설치해야 할 수도 있습니다. 드라이버 설치에 관한 도움은, OEM USB Drivers 문서를 참조하십시오.
2. Enable USB debugging on your device.
o
On most devices
running Android 3.2 or older, you can find the option under Settings
> Applications > Development.
Android 3.2 이상을 가동 중인 대부분의 장치에서, you can find the
option under Settings > Applications > Development.
o
On Android 4.0 and
newer, it's in Settings > Developer options.
Android 4.0 이상에서는, it's in Settings > Developer options 입니다.
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
Run the app from Android Studio 안드로이드 스튜디오로부터 앱을 가동하기
1.
Select one of your
project's files and click Run from
the toolbar.
your project's 파일들 중 하나를 선택한 다음, 툴바로부터 Run 을 클릭하십시오.
2.
In the Choose
Device window that appears, select the Choose a running device radio
button, select your device, and click OK .
나타나는 Choose Device window 안에서, Choose a running
device radio button을 선택한 다음, your device를 선택하고, OK 를 클릭하십시오.
Android Studio installs the app on your connected device and starts it.
Android Studio는 your connected device에 앱을 설치한 다음 그것을 시작시킵니다.
Run the app from a command line
Open a command-line and navigate to the root of your project directory.
Use Gradle to build your project in debug mode, invoke the assembleDebug build task using the Gradle
wrapper script (gradlew assembleRelease).
명령 줄을 열고 프로젝트 디렉토리의 루트로 이동합니다.Gradle 래퍼 스크립트 (gradlew
assembleRelease)를 사용하여 assembleDebug 빌드 작업을 디버그 모드에서 프로젝트를 빌드 호출 Gradle을 사용합니다.
This creates your debug .apk file inside the module build/ directory, named MyFirstApp-debug.apk.
On Windows platforms, type this command:
> gradlew.bat assembleDebug
On Mac OS and Linux platforms, type these commands:
$ chmod +x
gradlew
$ ./gradlew
assembleDebug
After you build the project, the output APK for the app module is located in app/build/outputs/apk/
Note: The first command (chmod) adds the execution permission to the Gradle wrapper script and is only necessary the first time you build this project from the command line.
Make sure the Android SDK platform-tools/ directory is included in your PATH environment variable, then execute:
adb install app/build/outputs/MyFirstApp-debug.apk
On your device, locate MyFirstApp and open it.
That's how you build and run your Android app on a device! To start developing, continue to the next lesson.
Run on the Emulator
에뮬레이터 가동하기
Whether you're using Android Studio or the command line,
to run your app on the emulator you need to first create an Android Virtual Device (AVD). An AVD is a device configuration for the Android emulator
that allows you to model a specific device.
안드로이드 스튜디오 또는 명령줄을 사용하든 에뮬레이터에서 앱을 실행하려면, 먼저 안드로이드 가상 장치(Android Virtual Device(AVD))를 만들어야 합니다. AVD는 특정 장치를 모델링 할 수 있는, 안드로이드 에뮬레이터에 대한 장치 구성입니다.
Create an AVD
1. Launch the Android Virtual Device Manager: 안드로이드 가상장치 관리자를 시작하십시오:
o
In Android Studio,
select Tools > Android > AVD Manager, or click the AVD
Manager icon in
the toolbar.
안드로이드 스튜디오에서, Tools >
Android > AVD Manager를 선택하거나 또는 툴바에서 AVD Manager icon 을 클릭하십시오.
o
Or, from the command
line, change directories to sdk/ and
execute:
또는 커맨드 라인에서 디렉토리 sdk/ 로 변경한 다음 실행시키십시오:
tools/android avd
Note: The AVD Manager that appears when launched from the
command line is different from the version in Android Studio, so the following
instructions may not all apply.
주: 커맨드 라인에서 시작하는 경우 나타나는 AVD 매니저는 안드로이드 스튜디오에서 나타나는 것과 다르기 때문에 다음 지침이 모두 적용되지 않을 수도 있습니다.
2. On the AVD Manager main screen (figure 1), click Create Virtual Device.
AVD Manager main screen (그림1) 위에서, Create Virtual Device를 클릭하십시오.
3.
In the Select
Hardware window, select a device configuration, such as Nexus 6, then
click Next.
Select Hardware 창에서 Nexus 6와 같은 장치 컨피규레이션을 선택한 다음, Next를 클릭하십시오.
4.
Select the desired
system version for the AVD and click Next.
AVD에 대한 요구되는 시스템 버전을 선택한 다음 Next를 클릭하십시오.
5.
Verify the
configuration settings, then click Finish.
configuration settings을 검증한 다음, Finish를 클릭하십시오.
For more information about using AVDs, see Managing AVDs with AVD Manager.
Run the app from Android Studio
1.
In Android
Studio, select your project and click Run from
the toolbar.
Android Studio에서 project를 선택한 다음, 툴바에 있는 Run 을 클릭하십시오.
2.
In the Device
Chooser window, click the Launch emulator radio
button.
Device Chooser window에서, Launch
emulator radio 버튼을 클릭하십시오.
3.
From the Android
virtual device pull-down menu, select the emulator you created, and
click OK.
Android virtual device pull-down 메뉴로부터, 이미 만든 emulator를 선택한 다음, OK를 클릭하십시오.
It can take a few minutes for the emulator to load itself. You may have to
unlock the screen. When you do, My First App appears on the
emulator screen.
에뮬레이터 자체를 로드하는데 몇 분이 걸릴 수 있습니다. 화면 잠금을 해제해야 할 수도 있습니다. 로드하면, My First App 이 에뮬레이터 화면에 나타납니다.
Run your app from the command line
1. Build the project from the command line. The output APK for the app module is located inapp/build/outputs/apk/.
2. Make sure the Android SDK platform-tools/ directory is included in your PATH environment variable.
3. Execute this command:
adb install app/build/outputs/MyFirstApp-debug.apk
4. On the emulator, locate MyFirstApp and open it.
That's how you build and run your Android app on the emulator! To start developing, continue to the next lesson.
Next: Building a Simple User Interface
'앱 개발하기' 카테고리의 다른 글
다른 Activity 시작하기 (0) | 2015.12.14 |
---|---|
간단한 사용자 인터페이스 구축하기 (0) | 2015.12.14 |
안드로이드 프로젝트 만들기 (0) | 2015.12.14 |
안드로이드 스튜디오는 안드로이드 앱을 개발하는 공식 IDE 입니다 (0) | 2015.12.14 |
안드로이드 스튜디오 설치하기 (0) | 2015.12.14 |
댓글