How to restart Android emulator and preserve system data

为君一笑 提交于 2019-12-07 02:49:25

问题


Is it possible to preserve system data (not SD card data) on Android emulator when it is shutdown? My specific problem is that I am trying to import a new root certificate into the /system/etc/security/cacerts.bks file, but that requires a restart, and when I do restart the emulator the file gets reverted to original state.


回答1:


The file is a part of the system image, and is not a part of the files created under .avd folder.

Found a link on how to backup/modify a system image. The comments are not in English, but the commands are pretty straightforward.




回答2:


I think that I once managed to do this by finding a temporary file that contained the modified /system image of the running emulator, and saving a copy which I later substituted for the initial image in an avd that I made to hack on.

Unfortunately I don't remember where I found the temp file. Playing with it at the moment the file called out in the avd seems to be changing and I can't find indication of any other candidates that are open. Perhaps what I did was copy that while the emulator was still running? At the moment dummy files I create in /system after remounting it writable seem to persist across emulator destruction and recreation without any effort on my part.

Additionally, are you sure that an actual reboot of the emulator is needed, that simply using the adb shell to 'stop' and then 'start' the android framework won't do the trick?



来源:https://stackoverflow.com/questions/4395975/how-to-restart-android-emulator-and-preserve-system-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!