ADB: useful commands

ADB: useful commands
Generic: 
adb kill-servre
adb start-server
adb devices à show all devices (ex: emulator-5554, emulator-5556)
abd shell à enter shell in single emulator condition
adb version à check adb version
系統資訊 dumpsys
 adb shell dumpsys [service_name]
 ex: adb shell dumpsys SurfaceFlinger
Log checking
adb shell dmesg à 會列印出Linux kernel log
 adb shell à shell@mt5399:/ $ su; cat /proc/kmsg à 持續印出 kernel log (需要 root)
adb shell logcat à (監控模擬器運作紀錄,以Ctrl + c 離開監控模式)
檔案存取 (ps: 似乎不能用同一個 AVD,沒辦法用 "*.*" 的方式傳檔)
adb push “.\00_tmp_dir\0.jpg” “/sdcard/0.jpg” à copy 單一檔案
adb push 00_tmp_dir “/mnt/ubsdisk/tmp_folder”   à copy 所有 folder 下的檔案到 sdcard
By net: adb -s [ip:5555] push ./local/test.txt ./device/test.txt
adb pull "/sdcard/00_file_to_be_removed.txt" "emu_file.txt"  à 把檔案從 emu 拷貝出來
adb pull /sdcard/00_tmp_dir ./tmp_folder   à copy emu 下的某個目錄到 pc 目前目錄
Command Pipe
adb shell “getprop | grep boot”
key event/input: 可用在 Android 瀏覽器 
adb shell input text "ANDROID" --> 輸入 "ANDROID" text
adb shell input keyevent 66    à 輸入 "enter“
adb shell input keyevent 07    à 輸入 1
(ps: key mapping: http://huenlil.pixnet.net/blog/post/23454601)
安裝檔案到 android emulator
adb install “.\00_tmp_dir\ch15_rotate_image.apk”
adb install -r filename.apk (保留已設定資料,重新安裝filename.apk)
adb install -s filename.apk (強制安裝)
adb uninstall mobile.android.ch15.rotate.image
    (ps: get apk by “ls /data/app”)
process related
adb shell ps -x (顯示 Android 上所有正在執行的行程)
adb top
adb server related (ENABLE_NET_ADB=true)
adb shell setprop service.adb.tcp.port 5555
adb shell “stop adbd; start adbd”
Two more PCBs are used:
ex:
 adb connect 172.22.243.122:5555
 adb connect 172.22.243.21:5555
 adb devices


 adb -s 172.22.243.121:5555 shell
 adb -s 172.22.243.21:5555 shell
 

猜你喜欢

转载自blog.csdn.net/u011961033/article/details/83065709
今日推荐