极力推荐文章:欢迎收藏
Android 干货分享 android
本篇文章主要介绍 Android
开发中的部分知识点,经过阅读本篇文章,您将收获如下内容:程序员
1、ADB 简介
2、ADB的工做方式
3、ADB经常使用命令
ADB(Android Debug Bridge) 是一个通用命令行工具,其容许您与模拟器实例或链接的 Android 设备进行通讯。它可为各类设备操做提供便利,如安装和调试应用,并提供对 Unix shell(可用来在模拟器或链接的设备上运行各类命令)的访问。该工具做为一个客户端-服务器程序。shell
adb 工具路径android_sdk/platform-tools/
缓存
ADB与本地 TCP 端口 5037 绑定,并侦遵从 adb 客户端发送的命令—全部 adb 客户端均使用端口 5037 与 adb 服务器通讯。而后,服务器设置与全部运行的Android模拟器/Android 设备链接。服务器
Settings >About phone>连续点击 Build number七次微信
此方法不经常使用,暂时忽略app
adb install apk路径
工具
adb unstall apk包名
学习
adb pull remote local
测试
adb push local remote
adb start-server
adb kill-server
adb shell screencap 文件保存路径
adb shell screenrecord 文件保存路径
按 Control + C 中止屏幕录制,不然,到三分钟或 --time-limit
设置的时间限制时,录制将自动中止。
screenrecord 部分参数
选项 | 说明 |
---|---|
--size width x height | 设置分辨率 eg:1280x720 |
--bit-rate rate | 视频比特率,默认值为 4Mbps,能够设6Mbps,这样质量更好 eg:adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4 |
--time-limit time | 设置最大录制时长(以秒为单位)。默认值和最大值均为 180(3 分钟)。 |
adb shell am start -a android.intent.action.VIEW
adb shell am start -n 包名/类名
adb shell am startservice 包名/类名
adb shell am boradcast -a 广播Action
adb shell force-stop 包名
adb shell pm uninstall 包名
adb shell pm list packages
adb shell pm list permission-groups
adb shell pm list features
adb shell pm path 包名
adb shell pm clear 包名
查看支持最多用户数adb shell pm get-max-users
查询系统全部用户adb shell pm list users
建立新用户adb shell pm create-user user_name
移除指定id用户adb shell pm remove-user user_id
adb shell dumpsys activity | findstr Run
adb shell dumpsys package com.xxx.xxx(包名)
adb shell top
adb shell ps
结合findstr 命令 过滤多余的信息 adb shell ps | findstr qq
adb logcat > 1.txt
adb logcat -s 关注log标签
adb logcat -c
adb shell dumpsys battery unplug
adb shell settings put global low_power 1
adb shell dumpsys battery reset
进入Recovery 模式可使用组合键,也可使用adb 命令
adb 命令进入recovery 模式以下adb reboot recovery
adb shell pm disable com.google.android.setupwizard adb shell settings put global device_provisioned 1 adb shell settings put secure user_setup_complete 1
启动开机向导命令
C:\Users\Administrator>adb shell am start com.google.android.setupwizard/.user.WelcomeActivity Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.google.android.setupwizard/.user.WelcomeActivity } C:\Users\Administrator>
至此,本篇已结束,若有不对的地方,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!