Android 12 adb push更新系统应用

需求描述

adb 传输文件的权限问题——remote couldn’t create file: Read-only file system

需要push /system/system_ext/priv-app/ 安装系统apk

adb root 
adb remount 

adb报错:remote couldn't create file: Read-only file system

解决

需要关闭linux kernel 安全验证功能 dm-verity
1. 关于 dm-verity

Device-Mapper’s “verity” target provides transparent integrity checking of block devices using a cryptographic digest provided by the kernel crypto API. This target is read-only.

adb --help 说明

disable-verity           disable dm-verity checking on userdebug builds
enable-verity            re-enable dm-verity checking on userdebug builds

2.关闭dm-verify

adb disable-verity

报错:Device is locked. Please unlock the device first using overlayfs

解决

(1) 进入开发者模式,打开OEM 解锁
(2) adb reboot bootloader进入fastboot模式
(3) fastboot flashing unlock, 需要在设备上面选择unlock,成功后会提示Finished. Total time: 0.025s
(4)如果机器没有自动重启,则执行fastboot reboot重启手机.在运行过程中我的机器会自动重启所以省略了这一步
(5)开机之后,依次adb root,adb disable-verity,adb reboot即可,此时查看OEM 解锁项是灰显的

adb disable-verity 提示
第一种提示: 说明没有打开OEM解锁

Device is locked. Please unlock the device first
using overlayfs
Now reboot your device for settings to take effect

第二种提示: 说明成功

using overlayfs
Successfully disabled verity
Now reboot your device for settings to take effect

注意:在fastboot reboot 后机器可能停止在logo加载过程中… ,此时可以直接adb 操作

第三种提示:adb remount 后提示,说明OEM adb disable-verity没成功

C:>adb root
C:>adb remount
Skipping /system for remount
Skipping /vendor for remount
Skipping /product for remount
No partitions to remount
remount failed

3. push 安装apk不生效

(1) adb shell 找到 apk 位置删除apk
(2) adb push 到上面删除位置
注: 直接push覆盖更新的代码不生效,需要手动删除
原因参考:https://blog.youkuaiyun.com/cengdong/article/details/71105059
(3)kill app生效

adb shell am force-stop com.android.gallery3d
adb shell am start -n com.android.gallery3d/com.android.gallery3d.app.GalleryActivity
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值