ADB 基本命令整理

2023-07-08 10:41 24次浏览 问答

Android debug bridge is a command line tool that lets you communicate with connected Android device。ADB COMMANDSADB Debugging1。
adb devicesPrints a list of all attached devices。Package Manager2。 adb installPushes an Android application (specified as a full path to an 。
apk file) to device。· adb install test。apk· adb install -r test。apk //replace existing application3。 adb uninstallRemoves a package from the emulator/device。
· adb uninstall com。test。app· adb uninstall -k com。test。app //Keep the data and cache directories around after package removal。
4。 adb shell pm list packagesPrints all packages, optionally only those whose package name contains the text in <FILTER>· adb shell pm list packages -s //Filter to only show system packages。
· adb shell pm list packages -3 //Filter to only show third party packages。· adb shell pm list packages -i //See the installer for the packages。
File Manager5。 adb pullDownload a specified file from the device to your computer。· adb pull /sdcard/demo。mp4 // download /sdcard/demo。
mp4 to <android-sdk-path>/platform-tools directory。· adb pull /sdcard/demo。mp4 e:\ // download /sdcard/demo。mp4 to driveE。
6。 adb pushUploada specified file from your computer to the device。· adb push test。apk /sdcard // Copies <android-sdk-path>/platform-tools/test。
apk to /sdcard directory。· adb push d:\test。apk /sdcard // Copies d:\test。apk to /sdcard directory。7。 adb shell lslist directory contents8。
adb shell cdchange directory9。 adb shell rmremove files or directoriesrm -f /sdcard/test。txt //force remove without promptrm -r /sdcard/tmp //remove the contents of directories recursivelyrm -d /sdcard/tmp //remove directory, even if it is a non-empty directory10。
adb shell mkdirmake directoriesmkdir /sdcard/tmp11。adb shell cpcopy fils and directories to destadb shellcp /sdcard/test。
txt /sdcard/demo。txt //cp [options] <source><dest>12。adb shell mvmove or rename filesadb shellmv /sdcard/tmp /system/tmp //movemv /sdcard/tmp /sdacrd/test //renameLogcatPrint log data to the screen。
l V—–show all info , verbose levell D—–show debug levell I—–show info levell W—–show warning levell E—–show error levell F—–show fatal leveln Radio—–about networkn Event—–activity manager/service managern Main—–defaultn Kernel—–CPU ,memoryn Bugreport—–ANR ,version ,serial13。
adb logcatadb logcat -v time >log。txt14。adb shell dumpsysdumps system dataadb shell dumpsys battery //查看电量信息adb shell dumpsys meminfo //查看内存信息adb shell dumpsys cpuinfo //查看cpu信息Screenshot15。
adb shell screencaptaking a screenshot of a device displayadb shell screencap /sdcard/screen。pngadb pull /adcard/screen。png //download the file from the device16。
adb shell screenrecordrecording the display of devices running Android 4。4 and higheradb shell screenrecord /sdcard/demo。
mp4adb pull /sdcard/demo。mp4 //download the file from the deviceSystem17。adb shell pslist the processadb shell ps auxadb shell pstree18。
adb shell getpropadb shell cat /system/build。prop //获取系统版本信息ro。build。id=KOT49Hro。build。display。id=KOT49H。20140814 test-keysro。
build。version。incremental=20140814ro。build。version。sdk=19ro。build。version。codename=REL该文件存放的数据是以这种等号形式存放的,而且它们是键值对成对出现的。现在我们再看看getprop取得的结果:[ro。
build。characteristics]: [mbx][ro。build。date。utc]: [1407987033][ro。build。date]: [2014-08-14 16:50:37][ro。build。description]: [k200-user 4。
4。2 KOT49H 20140814 test-keys][ro。build。display。id]: [KOT49H。20140814 test-keys]因此,getprop就是将配置文件里的信息读取出来并经过整理后,并以字典的形式展示给用户的。
adb shell getprop ro。serialno //获取版本序列号adb shell getprop ro。build。version。number //获取版本号Work Time日常设置1。电量设置adb shell dumpsys battery set level 502。
To capture screenshotadb shell screencap /sdcard/screen。pngadb pull /sdcard/screen。png3。To fetch System Versionadb shell getprop ro。
build。version。number4。To Disable USB Charging during adb connectionadb shell dumpsys battery set usb 0[usb powered : False -> can be verified from “adb shell dumpsys battery”]5。
To Enable USB Charging during adb connectionadb shell dumpsys battery set usb 1[usb powered : True -> can be verified from “adb shell dumpsys battery”]6。
To verify Battery Percentageadb shell dumpsys battery7。关键字搜索adb shelllogcat -v time | grep “OTA”8。抓取实时logadb logcat – v time >power。
txt—————————————————————————OTA1。device fullcd /data/mkdir spacedd if=/dev/zero of=/data/space/space。
dat bs=1048576 count=30002。cache fullcd cachemkdir spacedd if=/dev/zero of=/cache/space/space。dat bs=1048576 count=3503。Reader APPadb shelldumpsys package “com。
amazon。kindle” | grep ‘version‘4。MIGU APPadb shelldumpsys package ‘com。ophone。reader。ui‘ | grep version——————————————————————————–启动程序Run adb command to start ContentSupportTestApp — adb devices- adb shell- am start -n com。
amazon。android。app。contentsupport。testapp/。PackageListActivity——————————————————————————–KPI1。
刷机[查看版本信息]adb shell dumpsys package com。amazon。kindle | grep versionName2。传书adb push (750books) /sdcard/Documents3。adb shell setenforce Permissive4。
连接到debug board上Install screen to ubuntu:>apt-get install screenConnect your testing device to with serial cable, serial cable connect to normal usb cable, and normal usb cable to desktopEnter screen mode by cmd:>sudo screen /dev/ttyUSB0 115200Run cmd in screen mode:echo 0 > /proc/sys/kernel/printk(press enter button)echo 1 > /sys/module/printk/parameters/time(press enter button)echo 1 > /sys/devices/soc0/soc。
2/2000000。aips-bus/20f4000。epdc/mxc_epdc_debug(press enter button)echo 24 >/sys/devices/soc0/soc。2/2000000。aips-bus/20f4000。
epdc/temperature_override(press enter button)svc wifi disable(press enter button)getevent -tl &(press enter button)cat /proc/kmsg | grep -i ‘update end marker‘memory test1。
Collectthe same after execution of each case and refer the PSS TOTAL value for memory detailsadb shell dumpsys meminfo com。
amazon。kindle2。 Look out for LMK of “com。ophone。reader。ui” after execution of entire suiteadb logcat –v threadtime |grep lowmemorykiller3。
Get available memoryadb shell cat /proc/meminfoADB 基本命令整理。

相关推荐