б
제목 ADB Usage 번역
글쓴이 DreamyCnI 날짜 2018.08.17 11:35 조회 수 308

A D B Android Debug Bridge version 1.0.29

  

-d - USB 장치에 커맨드를 날림. 장치 없으면 에러 반환.

 

-e - 에뮬레이터에 커맨드를 날림. 동작중인 에뮬레이터 없으면 에러 반환.

 

-s <serial number> - 지정된 시리얼 번호를 가진 USB장치나 에뮬레이터에 연결. ANDROID_SERIAL 환경변수를 재정의 함

 

-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 - 연결된 모든 장치를 출력

connect <host>[:<port>] - TCP/IP를 통해 장치 연결. 기본 포트 5555

 

disconnect [<host>[:<port>]] - TCP/IP로 연결된 장치를 끊음. 주소를 적지 않으면 모든 연결 다 끊음.

 

device commands:

adb push <local> <remote> - 파일/폴더를 장치로 복사

adb pull <remote> [<local>] - 파일/폴더를 장치에서 복사

adb sync [ <directory> ] - host->device로 변경된 파일만 복사 (-l 옵션을 주면 나열만 하고 복사하진 않음)

adb shell - 리모트 Shell 실행

adb shell <command> - 리모트 shell 커맨드 수행

adb emu <command> - 에뮬레이터 console 커맨드 수행

adb logcat [ <filter-spec> ] - device log 보기

adb forward <local> <remote> - 소켓 연결을 전달. 전달 스펙은 다음과 같음

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 - JDWP transport를 호스팅하여 돌고있는 PID를 출력함

 

adb install [-l] [-r] [-s] <file> - 패키지 파일을 복사하고 설치함

('-l' forward-lock을 설정함)

('-r' 데이터를 유지하면서 app를 재설치함)

('-s' SD카드에 설치함)

 

adb uninstall [-k] <package> - app 패키지 삭제

('-k' app의 데이터와 캐시 디렉토리는 그대로 유지함)

 

adb bugreport - 장치로부터의 버그 리포트를 포함한 모든 정보를 반환함.

 

adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]

- 장치 데이터의 아카이브를 <file>에 저장함

-f 옵션이 지정되지 않으면 현재 경로의 "backup.ab" 파일에 저장됨.

(-apk|-noapk .apk파일들을 저장할 지 설정함. 기본값 noapk.)

(-shared|-noshared 공유 저장소와 SD카드 데이터를 백업할지 여부 설정. 기본값 noshared.)

(-all 모든 설치된 어플리케이션을 백업함)

(-system|-nosystem 시스템 어플리케이션을 자동으로 포함할지 토글. 기본값은 포함.)

(<packages...> 백업될 어플리케이션의 리스트. -all이나 -shared가 지정되어 있으면 패키지 리스트는 안적어도 됨. 커맨드라인에 명시적으로 표시된 어플리케이션은 -nosystem 옵션이 주어져 있어도 수행된다.

 

adb restore <file> - <file> 아카이브로부터 장치의 컨텐츠를 복원

adb help - show this help message

adb version - show version num

 

scripting:

adb wait-for-device - 장치가 online 될 때까지 대기

adb start-server - 동작중인 서버가 있는지 확인

adb kill-server - 동작중인 서버를 죽임

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

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

adb status-window - 특정 장치의 상태를 계속 출력함

 

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

 

adb reboot [bootloader|recovery] - 장치를 재부팅. 부트로더와 복원프로그램으로 재부팅할 수 있음

adb reboot-bootloader - 부트로더로 재부팅

adb root - adbd 데몬을 루트권한으로 재시작

adb usb - adbd 데몬을 USB 접속으로 재시작

adb tcpip <port> - adbd 데몬을 TCP/IP 접속으로 재시작

 

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> 몇 가지 방법으로 해석될 수 있음:

- <directory>가 명시되지 않았으면, /system와 /data 파티션 둘다 업데이트 됨

- "system" 또는 "data"로 명시하면 해당 파티션만 업데이트 됨

 

환경 변수:

ADB_TRACE - 디버그 정보를 출력함. 다음의 값을 콤마로 구분하여 나열함.

1 또는 all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp

ANDROID_SERIAL - 연결한 시리얼 넘버. -s 옵션이 우선순위가 더 높음.

ANDROID_LOG_TAGS - logcat 옵션을 사용할 때, 이 태그가 출력됨.