Android Studio Emulator启用root权限和系统分区写入

获得root权限

在使用Android Studio的Emulator模拟器时,要获取root权限,只需要使用以下命令:

$ adb root

但是,有个前提是使用的镜像必须不带play标识的,因为带play标识的镜像是正式版,正式版不允许获得root

启用写入权限

1、使用以下命令查询模拟器名称

$ emulator -avd -list-avds

2、使用以下命令启动模拟器

$ emulator -avd "步骤1查询的模拟器名称" -writable-system

3、模拟器启动完成后,使用以下命令获得root权限

$ adb root
restarting adbd as root

4、接着执行命令

$ adb remount
                                                  
Successfully disabled verity
virtual bool android::fiemap::ImageManagerBinder::MapImageDevice(const std::string &, const std::chrono::milliseconds &, std::string *) binder returned: Failed to map
[libfs_mgr] could not map scratch image
Failed to allocate scratch on /data, fallback to use free space on super
Using overlayfs for /system
Using overlayfs for /vendor
Using overlayfs for /product
Using overlayfs for /system_dlkm
Using overlayfs for /system_ext
Verity disabled; overlayfs enabled.
Now reboot your device for settings to take effect

5、然后执行命令,重启模拟器。模拟器重启完成后,再次获取root权限及挂载分区

$ adb reboot
$ adb root
$ adb remount

6、最后就可以向模拟器发送push命令,传送文件到system目录

$ adb push 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值