Android Debug Bridge version 1.0.22
[ 예제로 시작하는 안드로이드 개발(에이콘/릭 로저스 외 지음/ 978-89-6077-097-3) ]
주요 명령
adb devices
서버가 인식한 휴대폰과 에뮬레이터 목록을 보여준다. 연결된 devices의 TCP/IP 포트 알아낼 때 도움이 된다. -s나 -e 옵션은 여러 개의 장치를 때 특정한 디바이스를 지정할 때 사용한다.
adb shell
타겟 시스템의 쉘에 연결하고 # 프롬프트를 띄운다. 쉘은 간소한 유닉스 같아서 간단한 명령으로 타겟 시스템을 탐색하고 수정할 수 있다.
adb logcat [filter_spec]
로그캣 로그를 타겟 시스템에서 볼 수 명령. 현재까지 축적한 모든 로그를 터미널에 출력하고 시스템이 실행중인 동안 추가적인 로그도 계속 출력한다. 이 명령은 주로 맨 뒤에 &를 실행하는데, 이 기호를 명령 뒤에 붙이면 유닉스에서처럼 '별도의 프로세스로 이 실행하라'는 뜻이 된다.
adb logcat &
adb -b radio
adb -b events &
adb install [-l] [-r] file_spec
app을 설치하거나 재설치할 때
-l : 다른 장치로 복사돼 넘어가는 것을
-r : 이미 존재하는 app 데이터를 지우지 채 애플리케이션을 재설치 한다.
file_spec : 설치할 .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 error if more than one USB device is present.
-e
- directs to the only running emulator. returns an error if more than emulator is running.
-s <serial
- directs command to the USB or emulator with the given serial number
-p <product name or path>
- product name like 'sooner', or a relative/absolute path to a product out like 'out/target/product/sooner'. If -p is not specified, the ANDROID_PRODUCT_OUT environment variable used, which must be an absolute path.
devices - list all connected devices
device commands:
adb push <local> <remote> - copy file/dir to
adb pull <remote> <local> - copy 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
adb logcat [ <filter-spec> ] - device log
adb forward <local> <remote> forward socket connections
forward specs one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
pid> (remote only)
adb jdwp list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] <file> - push this package 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 from the device
('-k' means the data and cache directories)
bugreport - return all information from the device that should be in a bug report.
adb help show this help message
adb version show version num
DATAOPTS:
(no - don't touch the data partition
- wipe the data partition
-d flash the data partition
scripting:
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 is running
adb get-state - prints: | bootloader | device
adb get-serialno prints: <serial-number>
adb status-window - continuously device status for a specified device
remount - remounts the /system partition on the device read-write
adb reboot [bootloader|recovery] - reboots the device, into the bootloader or recovery program
root - restarts adb with root permissions
networking:
adb ppp <tty> [parameters] - Run PPP over
Note: you should not automatically start PPP connection.
<tty> refers to the 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 /data partitions will be updated.
- it is "system" or "data", only the corresponding partition is