mzlogin / awesome-adb Goto Github PK
View Code? Open in Web Editor NEWADB Usage Complete / ADB 用法大全
Home Page: https://mazhuang.org/awesome-adb/
License: MIT License
ADB Usage Complete / ADB 用法大全
Home Page: https://mazhuang.org/awesome-adb/
License: MIT License
刚看了另一个issue说 5.0以下的设备可以直接adb connect,但是在5.0以上不太一样,需要设备上执行过setprop service.adb.tcp.port 5555
之后重启adbd然后PC端才可以连接
安装 adbd Insecure后进入,弹框“ adbd Insecure SuperUser access is needed,but could not be acquired.Are you rooted and did you give permission?” 然后只有“OK”可以点,点“OK”后就闪退了。而且下了root大师,也一键root失败,该怎么解决?
在手机端使用系统自带的卸载功能卸载某app后,再使用adb命令进行安装,弹出以下错误:
INSTALL_FAILED_UPDATE_INCOMPATIBLE或者INSTALL_FAILED_ALREADY_EXISTS。
可以这样解决:
adb uninstall packagename
然后再安装
建议:查看已安装apk可以增加:查看已安装的第三方app和系统app
C:\Users\Edward\Desktop> adb -s Baytrail26AB2111 shell dumpsys activity package com.tencent.mm
在输出的信息 下拉找到这个位置:
·······
ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
Stack #1:
Task id #8
TaskRecord{22b6d760 #8 A=com.tencent.mm U=0 sz=1}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.tencent.mm/.ui.Launcher
UI }
Hist #0: ActivityRecord{224794a0 u0 com.tencent.mm/.ui.LauncherUI t8}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.tencent.mm/.ui.Laun
cherUI bnds=[129,163][309,363] }
ProcessRecord{2250b8e0 5300:com.tencent.mm/u0a188}
Running activities (most recent first):
TaskRecord{22b6d760 #8 A=com.tencent.mm U=0 sz=1}
Run #3: ActivityRecord{224794a0 u0 com.tencent.mm/.ui.LauncherUI t8}
mResumedActivity: ActivityRecord{224794a0 u0 com.tencent.mm/.ui.LauncherUI t8}
mFocusedActivity: ActivityRecord{224794a0 u0 com.tencent.mm/.ui.LauncherUI t8}
mFocusedActivity
就是 当前展示的activity
mac
地址那条命令启发,比如每次要想查看 ip地址 都要进入设置里面 查看 ,这里可以使用命令:C:\Users\Edward\Desktop> adb -s Baytrail26AB2111 shell netcfg
lo UP 127.0.0.1/8 0x00000049 00:00:00:00:00:00
sit0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
p2p0 UP 0.0.0.0/0 0x00001003 02:09:4c:11:27:e5
wlan0 UP 192.110.1.4/24 0x00001043 00:09:4c:11:27:e5
rmnet2 DOWN 0.0.0.0/0 0x00000000 1e:f9:44:33:fc:5f
rmnet1 DOWN 0.0.0.0/0 0x00000000 5e:e0:a8:e2:bd:d4
rmnet0 DOWN 0.0.0.0/0 0x00000000 9e:5f:16:47:34:75
其中wlan0 就是 设备通过wifi 连接的ip地址
或者使用:
C:\Users\Edward\Desktop> adb -s Baytrail26AB2111 shell ifconfig wlan0
wlan0: ip 192.110.1.4 mask 255.255.255.0 flags [up broadcast running multicast]
日志级别过滤应该是这样:
adb logcat "*:W"
不加双引号会报错
我应该怎么模拟电源键的的长按或者同时按电源键和音量键
不是文档的bug,就是讨论一下。
在三星S6,Android 7.0上,直接
adb shell screencap -p | sed "s/\r$//" > sc.png
会失败,文件可以创建,但是打不开图片,文件大小也是有的。
先adb shell screencap -p /sdcard/sc.png,再adb pull /sdcard/sc.png就没问题。
楼主提了adb shell wm 查看当前的分辨率和密度,居然没提设置,超级有用的一条命令。
adb shell wm size 480x854 临时设置屏幕尺寸
adb shell wm density 200 临时设置屏幕密度
adb shell wm overscan 0,200,100,0 缩小屏幕
恢复默认用 reset 参数
一些小厂定制的rom 可能修改过该 常量名 ,如果无法找到 可以使用 匹配搜索
$ adb -s 0123456789ABCDEF shell cat /system/build.prop | grep ro.product.cpu.abi
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
名词:
adbd server: Android设备上运行的adbd程序,即adb服务端
adb server: 本地运行的adb server,即adb客户端创建的server
===多个本地机器用adb同时连接同一个Android设备
需要使用adb无线连接(高版本可以不需要,见下)
低版本Android(Android5.0以下,不包含)可以直接使用adb connect命令连接,高版本Android不行,原因见下。
高版本adbd(Android5.0以上)只支持一个adb server,再创建adb server(如adb -P 5038 start-server),然后adb -P 5038 connect ... ,再使用 adb -P 5038 devices ,会显示设备为offline状态。 如果要实现多adb客户端,只能共用adb server
高版本adb支持 -H -P参数,从而支持连接到远程的adb server。 -H 参数可以指定目标adb server的ip地址。可以使用 本地端口映射工具(如netsh) 将第一个机器的adb server监听的地址如127.0.0.1:5037,映射到0.0.0.0:5038供外网访问。
netsh interface portproxy add v4tov4 listenport=8001 connectport=80 connectaddress=127.0.0.1
参考 https://blog.csdn.net/u011014032/article/details/46331687
ADB直接传图片到手机上,手机相册是看不到的。因为安卓有个广播机制,传入图片后还需要通知这个广播机制才能在图库里查看到传入的图片。
adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file:///storage/sdcard0/picture/test.jpg
其中/storage/sdcard0/picture/test.jpg
就是该图片的路径
使用adb 模拟广播发送的,希望写的详细点,你举得例子看不明白
增加使用 adb 清除数据的用法
Usage: service [-h|-?]
service list
service check SERVICE
service call SERVICE CODE [i32 INT | s16 STR] ...
Options:
i32: Write the integer INT into the send parcel.
s16: Write the UTF-16 string STR into the send parcel.
service list 会有很多服务可用,不知道有没有人都试过~
在终端里 adb shell am startservice 启动服务,在我的service开启了线程,发现没有等待我service执行完毕,终端就停止了(可以执行下一条指令),有什么方法保持同步或者监听service stop了
com.android.ddmlib.AdbCommandRejectedException: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
Error while Installing APK
谢谢这么全的指引!
我在参考无线连接(需要root权限)一节指引中发现下面步骤有缺失
- 打开 Android 设备上的终端模拟器,在里面依次运行命令:
su setprop service.adb.tcp.port 5555
设置端口后还需要重启adbd服务
stop adbd
start adbd
adb的命令不算多有正规的帮助还算好整理,shell实在太多了,希望能整理出安卓版本间比较共用的命令。
adb forward也可以介绍一下哦
Table of Contents 前的部分
RT,暂未想到好的解决办法。
https://github.com/mzlogin/awesome-adb#%E6%9F%A5%E7%9C%8B%E5%89%8D%E5%8F%B0-activity
首选命令写的有问题,在window控制台中无法执行,需修改为:
adb shell "dumpsys activity activities | grep mFocusedActivity"
另外新的Android中dumpsys activity activities的输出中已经无法通过focuse关键字定位前台Activity了,可修改为:
adb shell "dumpsys activity activities | grep Run #"
DELETE_FAILED_INTERNAL_ERROR
Error while Installing APKs
在 Android Studio 向 Android 7.0 安装 apk 时提示要先卸载手机上已有应用,但实际上手机上未安装,点击卸载后出现此错误。
解决方案:
关闭 instant run
Could you provide English translation, Repository looks ultimately useful 👍
cat /proc/<pid>/status
adb shell dumpsys package <packagename> | grep userId=
参考:
怎样在ADB SHELL中打开USB共享网络?
一直找不到这个命令。
对于银行类应用(工行、建行)的登录界面如何截图,screencap取不到。
写的稍微有点乱,lz自己整理下。
adb install 1.0.36会出现安装进度。
adb install的过程:
缺点,目前的adb install不会删除到残留在/data/local/tmp下的安装包
手动安装方法
adb push some.apk /data/local/tmp/
adb shell pm install /data/local/tmp/some.apk
adb shell rm /data/local/tmp/some.apk
BTW: adb在mac上还有更好的实现 https://github.com/facebook/fb-adb
如题
-l
的中文/英文的含义 和命令里的解释不一样 install [-lrtsdg] PACKAGE
install-multiple [-lrtsdpg] PACKAGE...
push package(s) to the device and install them
-l: forward lock application
-r: replace existing application
-t: allow test packages
-s: install application on sdcard
-d: allow version code downgrade (debuggable packages only)
-p: partial application install (install-multiple only)
-g: grant all runtime permissions
-rld
这样子连着写法 无法被识别 要 拆成多个参数拼接才可以友情提醒:在8.0开始 如果继续使用 -l
参数会抛该异常java.lang.IllegalArgumentException: New installs into ASEC containers no longer supported
我测试了一下,点击屏幕用时1s左右,截图就需要4s,感觉速度太慢,一些实时性的游戏就适应不了,adb能不能再快一点呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.