adb
跳转到导航
跳转到搜索
通过 Wi-Fi 连接
启用:
adb tcpip 5555
然后就可以连接了:
adb connect IP
重启设置后失效(Android 6)。
端口转发
将本机的 2223 端口转发到手机上的 2222 端口。[1]
adb forward tcp:2223 tcp:2222
降级安装
adb install -d -r APK
-d 允许降级,-r 允许覆盖。
备份
备份所有可以备份的包:
adb backup -apk -keyvalue -all
注意:
- 此方法并不能备份设置了
allowBackup为false的应用[3] - 使用
-shared时,备份会因为太大而被截断 - 未加密备份的解包方式:其中
tail -n +5 backup.ab | deflate | tar xv
deflate是一个执行 zlib 解压的程序[4]
启动活动
启动 Documents UI(MIUI 上没有入口):
adb -s phone_mi:5555 shell am start -n com.android.documentsui/.files.FilesActivity
刷新媒体缓存
adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d "file://$filepath"
设置动画速率
使用 adb shell 执行:
settings put global window_animation_scale 0.3
settings put global transition_animation_scale 0.3
settings put global animator_duration_scale 0.3
设置主题
在 adb shell 执行:[6]
settings put secure theme_customization_overlay_packages '{"_applied_timestamp":1731638639852,"android.theme.customization.color_index":"1","android.theme.customization.system_palette":"C64FFF","android.theme.customization.accent_color":"C64FFF","android.theme.customization.color_source":"preset","android.theme.customization.theme_style":"TONAL_SPOT"}'
如果直接在 adb 后边执行,要注意需要额外地转义。
参见
外部链接
参考资料
- ↑ 浅析adb命令 - adb forward交互流程 - wanghui_nju的专栏 - 博客频道 - CSDN.NET
- ↑ applications - How to downgrade an app if it has been updated via Play Store? - Android Enthusiasts Stack Exchange
- ↑ Android 属性 allowBackup 安全风险浅析 - 阿里聚安全 - SegmentFault 思否
- ↑ Is there a way to look inside and modify an adb backup created file? - Android Enthusiasts Stack Exchange
- ↑ [1]
- ↑ [Task Share Dynamic Custom Theming : r/tasker]