如何将文件复制到 Android 的 /system 文件夹

How to copy a file to Android's /system folder

我是 运行ning Android 模拟器(模拟器版本 30.5.5.0)和来自 AndroidStudio 的 avd: Pixel_3a_API_30_x86。 使用 adb.exe(Android 调试桥)我尝试将文件从 Windows 主机复制到模拟的 Android /system/... 文件夹,但我还没有能够在尝试不同的事情之后 this tutorial:

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

然后从另一个命令行 window 而模拟器是 运行ning:

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

运行adb root && adb remount先.

link 中的教程缺少一些命令和 the web page was not updated with the latest version from 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