原文地址 https://blog.csdn.net/u010375364/article/details/52344120 原文链接:https://github.com/mzlogin/awesome-adb ADB 常用用法大全,收集了在开发、测试和普通用户使用
ADB,即 Android Debug Bridge,它是 Android 开发/测试人员不可替代的强大工具,也是 Android 设备玩家的好玩具。
持续更新中,欢迎提 PR 和 Issue 补充指正,觉得有用的可以将 此 GitHub 仓库 Star 收藏备用。
注: 有部分命令的支持情况可能与 Android 系统版本及……继续阅读 »
sharezer
4年前 (2019-08-12) 2151浏览 0评论
0个赞
做一下记录:
find /sdcard/log/crash/ -mtime +30 | xargs rm -rf
……继续阅读 »
sharezer
6年前 (2017-08-10) 2288浏览 0评论
0个赞
pm dump【包名】| grep -A 1 android.intent.action.MAIN: | tail -1
PS:windows貌似不能使用tail
……继续阅读 »
sharezer
6年前 (2017-07-03) 2300浏览 0评论
1个赞
/**
* 通过包名获取task id,不存在为-1
*
* @param packageName
* @return
*/
public int getTaskId(String packageName) {
String result = execRootCmd("dumpsys activity | grep " + packageName);
int start = result.indexOf("TaskRecord{");
if(start > 0){
int end = result……继续阅读 »
sharezer
6年前 (2017-07-03) 3270浏览 0评论
0个赞
/**
* 返回当前的应用是否处于前台显示状态
*
* @param packageName
* @return
*/
public boolean isTopActivity(String packageName) {
String result = execRootCmd("dumpsys activity | grep \"mResumedActivity\"");
int start = result.indexOf("u0") + 3;
int end = result.indexOf("/");
Log.d(TAG, "s: " + sta……继续阅读 »
sharezer
6年前 (2017-06-02) 2699浏览 0评论
3个赞
这里使用的是ps命令,不用root或系统权限。
public int getPid(String name) {
String cmd = ("ps | grep " + name);
String str = execRootCmd(cmd);
if (str == null || str == "" || str.length() < 1)
return -1;
else {
String[] arr = str.split("\\s+");
……继续阅读 »
sharezer
6年前 (2017-06-02) 3250浏览 0评论
5个赞
// 执行命令并且输出结果
private String execRootCmd(String cmd) {
Log.d(TAG, "cmd: " + cmd);
String result = "";
DataOutputStream dos = null;
DataInputStream dis = null;
try {
Process p = Runtime.getRuntime().exec("su");// 经过Root处理的android系统即有su命令
……继续阅读 »
sharezer
6年前 (2017-06-02) 2395浏览 0评论
2个赞
public String execRootCmd(String cmd) {
String result = "";
DataOutputStream dos = null;
DataInputStream dis = null;
try {
Process p = Runtime.getRuntime().exec("su");// 经过Root处理的android系统即有su命令
dos = new DataOutputStream(p.getOutputStream());
……继续阅读 »
sharezer
7年前 (2017-04-11) 7115浏览 2评论
21个赞
步骤:
root权限
解除目录权限
拷贝更新文件
赋值644权限给安装的文件
重启
su
mount -o remount/system/app
cp mnt/sdcard/sda1/DanceDemp.apk /system/app //app下有时候不行,改到/system下
chmod 644 /system/app/DanceDemp.apk
reboot
……继续阅读 »
sharezer
7年前 (2016-07-27) 2316浏览 0评论
0个赞