ls = dir
clear = cls
dir = 현재 경로에 속한 파일 확인
adb shell
바탕화면 이동 터미널 명령어
cd %userprofile%\desktop
adb devices
adb devices -l : 기기가 무엇인지 알려준다, 여러 기기일 경우 유용
adb -s [디바이스이름] shell
// 특정 디바이스에 앱 설치
adb -s [디바이스이름] install ex.apk
- shell 연결시
$adb -s [디바이스이름] shell
adb reboot
adb kill-server
adb install test1.apk
adb install -r test1.apk : 설치된 어플 재설치 (데이터 삭제 불가)
adb install -s test1.apk : 메모리 카드에 설치
adb shell dumpsys window | find "mCurrentFocus"
adb shell dumpsys activity activities | grep mResumedActivity
'/'을 기준으로 왼쪽이 AppPackage , 오른쪽이 AppActivity
dumpsys = 안드로이드 폰의 어플리케이션 및 현재 기기의 상태에 대한 자세한 정보를 제공한다.
adb shell am start -n 패키지명/액티비티명
adb shell am force-stop 패키지명
adb uninstall [-k] 패키지명
-k : app의 데이터는 보존
adb shell pm uninstall --user 0 패키지명
adb shell getprop ro.build.version.sdk
adb shell pm clear 패키지명
adb root
adb unroot
exit
adb shell am start -a android.settings.SETTINGS
adb shell getprop ro.product.model
- 캡쳐
adb shell screencap -p /sdcard/screen.png
adb shell screencap -p /sdcard/Pictures/screenshot.png
- 윈도우 가져오기
adb pull /sdcard/screen.png
- 지우기
adb shell rm /sdcard/screen.png
- 녹화
adb shell screenrecord /sdcard/demo.mp4
- 윈도우 가져오기
adb pull /sdcard/demo.mp4
- 지우기
adb shell rm/sdcard/demo.mp4
녹화의 경우 control+c를 통해 녹화 중지 가능
중지하지 않으면 녹화과 3분 또는 --time-limit로 설정한 시간 한도에서 중지
aab -s 특정기기 install 테스트.apk
adb forward tcp:6100 tcp:7100
임의의 포트 전달을 설정할 수 있고 포트 전달은 특정 포트의 요청을 기기의다른 포트로 전달
adb pull remote local
adb push local remote
adb shell input text "text"
adb shell cat /proc/uptime
1. usb 로 연결 한다
2. adb tcpip 5555 : 5555번에 연결한다.
3. usb 연결을 끊는다
4. android기기의 ip 주소를 찾는다.
5. adb connect IP:5555
6. adb devices
기기가 잘 연결되었는지 확인한다.
만약 연결이 끊어지는 경우 서버 재설정
adb usb
adb logcat
adb shell
# logcat
-c : clear 옵션
-v : 출력 형태 설정 옵션
-d : 출력 후 종료 옵션
-s : 출력 로그의 우선순위 레벨 선정
adb logcat -f file_name : 로그 메시지 파일로 저장
grep: 로그 메시지에서 원하는 텍스트 검색
adb logcat | grep "ERROR" => "ERROR" 키워드 포함 로그 메시지 표시
adb logcat*.<log_level> : 특정 로그 레벨에 대한 메시지 필터링
EX ) adb logcat *.E : 오류 메시지만 표시
adb logcat --pid = 프로세스 id , pid의 로그 출력, 특정 로그 출력
adb shell "ps | grep com.example" : pid 구하기
adb shell ps : pid 구하기
adb shell pidof [example]
$ adb logcat -v color : 로그 레벨별 색 적용
(DEBUG: 파랑, INFO: 초록 , WARNING: 노랑, ERROR, FATAL:빨강)
$ adb logcat -s "example:*" -v time : time 출력
adb logcat -g : 버퍼 크기 확인
log 출력 필터링
V: Verbose(가장 낮은 우선순위)
D: Debug
I: Info
W: Warning
E: Error
F: Fatal
S: Silent(가장 높은 우선순위, 아무것도 출력되지 않음)
adb logcat *:W : warning 이상의 모든 로그 표시
-CPU 아키텍처 확인
adb shell getprop ro.product.cpu.abi