Android 常见问题解决备忘
常用ADB 命令集合
更新
1
2
3
4
5
619.09.27 初始
19.10.10 整合相关内容
20.02.15 adb 调试
20.08.28 twrp 备份
20.09.07 exchange 同步
21.03.30 同步一些内容
导语
- 这算是 Android 日常遇见问题的备忘.
修改NTP服务器
最近收了几个测试机,每次重启必定时间错乱.虽然就是个开机脚本的事情.还是配置正确NTP是正道.
这里用了阿里云提供的NTP服务器,还是挺稳定的.
命令
1
adb shell "settings put global ntp_server time1.aliyun.com"
AOT 编译
参考资料
https://sspai.com/post/56677
Android 自 4.4 引入 ART 后就一直有个问题,应用安装时间过长.AOT 是一次性将应用编译成 odex .安装时间过长无法避免.
但用户体验非常差,google 想取得一点平衡.Android 7 以后,应用安装后并不会立刻全部编译成 odex.而是插上电源情况下,手机有空才把未 odex 化的应用,继续 odex. 后来干脆通过 google play 下发odex化配置,只将最常使用的代码部分优先编译.这样在空间,速度,安装时间上取得平衡.
但是真心不在乎一点存储空间的,不想等play下发配置,而且N多测试机只想知道odex化后能加快多少.
代码(adb or shell)
1
2
3
4
5
6
7
8
9
10
11# 强制编译某个软件包 微信
cmd package compile -m speed -f com.tencent.mm
# 强制编译所有软件包
cmd package compile -m speed -f -a
# 清理odex化 需要 root 权限
# 获取 root 权限
su
# 清除微信的被编译代码
cmd package compile --reset com.tencent.mm
# 清除所有被编译的代码
cmd package compile --reset -a应用启动速度确实快了一些…并不包括全家桶…
去掉叉号,修改网络验证
google服务器被墙,导致网络验证一直失败,总是会切换到流量上.
修改验证服务器,7.1.1以后有变动.
参考
https://ericclose.github.io/Captive-Portal-Android.html
代码
1
2
3
4
5
6
7
8
9
10
11
12
13# 删除地址就可以恢复默认的谷歌服务器
adb shell settings delete global captive_portal_server
# 设置一个可用地址
adb shell settings put global captive_portal_server http://developers.google.cn/generate_204
# 查询当前地址
adb shell settings get global captive_portal_server
# 7.0-9.0 删除(删除默认用HTTPS)
adb shell settings delete global captive_portal_https_url
adb shell settings delete global captive_portal_http_url
# 设置一个可用地址
adb shell settings put global captive_portal_http_url http://developers.google.cn/generate_204
adb shell settings put global captive_portal_https_url https://developers.google.cn/generate_204
adb 调试 error: more than one device/emulator
问题:
- 简单的调试应用,却遇到了 error: more than one device/emulator 的错误.
解决
- 看错误是有多个 adb 设备, adb devices 看一下除了调试机外多出了一个 emulator-5554 offline 的设备.
- 尝试
adb kill-server
,taskkill /f /im adb.exe
都不顶用.无语了😶, emulator-5554 是个什么设备? - 把模拟器等都检查了一遍,没问题.破罐子破摔,看一下端口吧.嗯?等等, 5555 端口怎么被占用了?还是 dns? 😵?
- overture 有 http 调试功能,默认写在了 5555 端口,但是 adb 不认识.
- …
twrp 备份 createtarfork() process ended with error 255
最近在执行 twrp 备份时,频频遇到 createtarfork() process ended with error 255
.
搜索后 解决TWRP备份&恢复提示 createTarFork & extractTarFork 255 错误! [复制链接]
这个错误与多用户有关,一加5 的是应用双开.而此设备上应该是 炼妖壶.暂时移除炼妖壶的工作空间.备份-> 搞定.
exchange 同步
exchange 是微软的专有的电子邮件同步协议.
在 android 6/7/8 时代一直在用.但是最近需要时,才发现 android Q 中添加账户居然没有 exchange…
初想下是不是缺少 exchange 组件,又去解包了 Rom 发现根本没有 email 的客户端…
经过一轮搜索…gmail 把这个部分合并了…安装上 gmail,添加账户 exchange pop 等都回来了…
双开/多开问题
一般用炼妖壶隔离耗电大户,但是随着 Android R 的更新,倒像是一个大坑.
数据路径
- 多用户的 sd 卡在
/mnt/passthough
下. - 多用户应用数据在
/data/user/xx
下.
一些应用需要 obb 文件一般在 apkpure 下载,必须对应版本.
obb 文件放在 /mnt/passthough
对应路径,还需要看看存储重定向.目前主要是微信.
Android R 刷机基本步骤
进入 TWRP
clean && 格式化 data 存储
刷入底包/zip/migisk 等
重启
屡试不爽