首页 > 解决方案 > 如何将文件复制到 Android 的 /system 文件夹

问题描述

我正在运行 Android 模拟器(模拟器版本 30.5.5.0)和Pixel_3a_API_30_x86来自 AndroidStudio的 avd:。使用adb.exe(Android Debug Bridge)我尝试将文件从 Windows 主机复制到模拟的 Android文件夹,但在尝试了类似本教程/system/...的不同操作后我无法做到:

cd C:\Users\%username%\AppData\Local\Android\Sdk\emulator
emulator -avd Pixel_3a_API_30_x86 -writable-system

然后在模拟器运行时从另一个命令行窗口:

cd C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools

adb root
adb shell "mount -o rw,remount /"
'/dev/block/dm-0' is read-only

adb push MyFile.txt /system/etc/security/cacerts

然后我得到错误:错误:

MyFile.txt: 1 file pushed, 0 skipped. 0.1 MB/s (950 bytes in 0.011s)
adb: error: failed to copy 'MyFile.txt' to '/system/etc/security/cacerts/MyFile.txt': remote couldn't create file: Read-only file system

如何将文件从 Windows 复制到 Android /system

标签: androidandroid-emulatoradb

解决方案


链接中的教程缺少一些命令,并且网页未使用来自 GitHub 的最新版本进行更新。

这是最终序列(对于 API LEVEL > 28):

adb root
adb shell avbctl disable-verification
adb reboot
adb root
adb remount

adb push MyFile.txt /system/etc/security/cacerts

推荐阅读