1.adb shell screenrecord /sdcard/demo.mp4 //录屏
adb shell /system/bin/screencap -p /sdcard/screenshot.png //截图
2.adb logcat -b events -v time > logEventxxx //打印event log
3.adb shell am stack list //打出栈信息从而判断按返回键后应该跳到哪个界面
4.adb shell dd if=/dev/zero of=/mnt/sdcard/bigfile //快速填满手机磁盘空间
5.adb shell am start -W xxx/xxActivity //计算Activity(包名/类名)启动时间
6.adb shell pm list package -f |grep "包名或是关键字" //列出指定"包名或是关键字"的packages列表
7.pm list packages // 列举安装的所有app包信息
8.adb shell clear pm clear xxx.xxx.xxx //清除包名为xxx.xxx.xxx应用的缓存数据
9.adb shell dumpsys package xxx.xxx.xxx.xxx |grep version //打印指定apk的版本信息
10.adb shell dumpsys activity activities 查看Activity信息
11.adb logcat *:E //只显示Error级别的log
12.adb logcat -v threadtime -s [TAG] //logcat时可以查看某个tag的所有log
13.adb shell stop //软重新启动
adb shell start
14.java -jar AXMLPrinter2.jar AndroidManifest.xml //把apk解压后查看AndroidManifest.xml 文件
15.adb logcat -G 20m //adb logcat时出现:read: unexpected EOF!
16.dumpsys activity activities
17.adb shell uptime //查看开机时长
18.查看应用是否签名命令
cd /xxx/jdk1.8.0_152/bin
jarsigner.exe -verbose -certs -verify /xxx/your.apk
19.adb shell pm revoke [packageName] [permissionName] //移除指定权限
adb shell pm revoke com.tencent.mm android.permission.CAMERA /移除微信相机权限
20.adb shell pm grant [packageName] [permissionName] //授予指定权限
adb shell pm grant com.tencent.mm android.permission.CAMERA //给微信授予相机权限
21.adb shell pm list permissions -d -g //按组查看权限,查看权限的分组情况
22.adb shell lpdump //查看分区
23.adb shell pm disable com.android.provision/com.android.provision.WelcomActivity然后stop、start一下 //跳过开机向导
24.应用签名
java -Djava.library.path=. -jar signapk.jar platform.x509.pem platform.pk8 SafeAnti-v2.4.6.apk SafeAnti-v2.4.6_signed.apk
25.java -jar AXMLPrinter2.jar AndroidManifest.xml //把apk解压后查看AndroidManifest.xml 文件
26.修改分辨率等
wm size 392x1260
wm density 240
27.adb shell settings get secure default_input_method
adb shell settings get secure enabled_input_methods
28.ps -AT
29.logcat -b all
30.am命令常用合集
am start [options] <INTENT> 启动Activity startActivityAsUser
am startservice <INTENT> 启动Service startService
am stopservice <INTENT> 停止Service stopService
am broadcast <INTENT> 发送广播 broadcastIntent
am kill <PACKAGE> 杀指定后台进程 killBackgroundProcesses
am kill-all 杀所有后台进程 killAllBackgroundProcesses
am force-stop <PACKAGE> 强杀进程 forceStopPackage
am hang 系统卡住 hang
am restart 重启 restart
am bug-report 创建bugreport requestBugReport
am dumpheap <pid> <file> 进程pid的堆信息输出到file dumpheap
am send-trim-memory <pid> <level> 收紧进程的内存 setProcessMemoryTrimLevel
am monitor 监控 MyActivityController.run
31.pm命令常用合集
pm list packages 列举app包信息 PMS.getInstalledPackages
pm install [options] <PATH> 安装应用 PMS.installPackageAsUser
pm uninstall [options]<package> 卸载应用 IPackageInstaller.uninstall
pm enable <包名或组件名> enable PMS.setEnabledSetting
pm disable <包名或组件名> disable PMS.setEnabledSetting
pm hide <package> 隐藏应用 PMS.setApplicationHiddenSettingAsUser
pm unhide <package> 显示应用 PMS.setApplicationHiddenSettingAsUser
pm get-install-location 获取安装位置 PMS.getInstallLocation
pm set-install-location 设置安装位置 PMS.setInstallLocation
pm path <package> 查看App路径 PMS.getPackageInfo
pm clear <package> 清空App数据 AMS.clearApplicationUserData
pm get-max-users 最大用户数 UserManager.getMaxSupportedUsers
pm force-dex-opt <package> dex优化 PMS.forceDexOpt
pm dump <package> dump信息 AM.dumpPackageStateStatic
pm trim-caches <目标size> 紧缩cache目标大小 PMS.freeStorageAndNotify
32.查看数据库
adb root
adb remount
adb shell
cd /data/data/com.xxx.proof/databases
sqlite3 xxx.db
.tables //确认有events
select * from usage_record;