OS/Linux

[Android] ADB - Android SDK Tools -

아르비스 2010. 5. 25. 14:39

주요 명령



adb devices


adb 서버가 인식한 휴대폰과 에뮬레이터 목록을 보여준다. 연결된 devices의 TCP/IP 포트 번호를 알아낼 때 도움이 된다. -s나 -e 옵션은 여러 개의 장치를 연결했을 때 특정한 디바이스를 지정할 때 사용한다.


adb shell

타겟 시스템의 쉘에 연결하고 # 프롬프트를 띄운다. 쉘은 간소한 유닉스 쉘 같아서 간단한 명령으로 타겟 시스템을 탐색하고 수정할 수 있다.


adb logcat [filter_spec]

로그캣 로그를 타겟 시스템에서 볼 수 있는 명령. 현재까지 축적한 모든 로그를 터미널에 출력하고 시스템이 실행중인 동안 발생하는 추가적인 로그도 계속 출력한다. 이 명령은 주로 맨 뒤에 &를 붙여서 실행하는데, 이 기호를 명령 뒤에 붙이면 유닉스에서처럼 '별도의 프로세스로 이 명령을 실행하라'는 뜻이 된다.

adb logcat AndroidRuntime:E &

adb -b radio &

adb -b events &


adb install [-l] [-r] file_spec

app을 설치하거나 재설치할 때 사용한다.

-l : 다른 장치로 복사돼 넘어가는 것을 막는다.

-r : 이미 존재하는 app 데이터를 지우지 않은 채 애플리케이션을 재설치 한다.

file_spec : 설치할 app의 .apk 파일


adb uninstall [-k] package

패키지 이름을 가진 app을 제거하다.

-k : app의 데이터를 보존한다.

package : 패키지의 전체 경로, .apk 확장자는 빼야 한다.


adb push local remote

개발자 컴퓨터에 있는 local이란 이름을 가진 파일을 타겟 시스템에 remote란 이름으로 복사한다.


adb pull remote local

타겟 시스템에 있는 remote라는 파일을 개발자 컴퓨터에 local이란 이름으로 복사한다.


adb


-d
- directs command to the only connected USB device
returns an error if more than one USB device is present.

-e
- directs command to the only running emulator.
returns an error if more than one emulator is running.

-s <serial number>
- directs command to the USB device or emulator with
the given serial number

-p <product name or path>
- simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT environment variable is used, which must be an absolute path.

devices - list all connected devices


device commands:


adb push <local> <remote> - copy file/dir to device

adb pull <remote> <local> - copy file/dir from device

adb sync [ <directory> ] - copy host->device only if changed
(see 'adb help all')

adb shell - run remote shell interactively

adb shell <command> - run remote shell command

adb emu <command> - run emulator console command

adb logcat [ <filter-spec> ] - View device log

adb forward <local> <remote> - forward socket connections

forward specs are one of:

tcp:<port>

localabstract:<unix domain socket name>

localreserved:<unix domain socket name>

localfilesystem:<unix domain socket name>

dev:<character device name>

jdwp:<process pid> (remote only)

adb jdwp - list PIDs of processes hosting a JDWP transport

adb install [-l] [-r] <file> - push this package file to the device and install it

('-l' means forward-lock the app)

('-r' means reinstall the app, keeping its data)

adb uninstall [-k] <package> - remove this app package from the device

('-k' means keep the data and cache directories)

adb bugreport - return all information from the device
that should be included in a bug report.

adb help - show this help message

adb version - show version num


DATAOPTS:


(no option) - don't touch the data partition

-w - wipe the data partition

-d - flash the data partition


scripting:


adb wait-for-device - block until device is online

adb start-server - ensure that there is a server running

adb kill-server - kill the server if it is running

adb get-state - prints: offline | bootloader | device

adb get-serialno - prints: <serial-number>

adb status-window - continuously print device status for a specified device

adb remount - remounts the /system partition on the device read-write

adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program

adb root - restarts adb with root permissions


networking:


adb ppp <tty> [parameters] - Run PPP over USB.

Note: you should not automatically start a PPP connection.

<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1

[parameters] - Eg. defaultroute debug dump local notty usepeerdns


adb sync notes: adb sync [ <directory> ]


<localdir> can be interpreted in several ways:

- If <directory> is not specified, both /system and /data partitions will be updated.

- If it is "system" or "data", only the corresponding partition is updated

[ http://d.android.com/guide/developing/tools/adb.html ]

[ 예제로 시작하는 안드로이드 개발(에이콘/릭 로저스 외 지음/ 978-89-6077-097-3) ]