Is it possible to get a clean emulator state even in runtime? I need to test several Apps, and need a clean state before testing each app. I can easily do this with deleting all the created files like userdata.img or cache.img but then i need to reboot the emulator which takes about 2 minutes on my TestVM…
Is it possible to get a clean emulator state even in runtime? I need
Share
All of your applications’ modifiable files live in well-known directories, such as
getFilesDir(). Simply delete the files before launching your test suite.If you do not trust that approach, then you can uninstall the app before installing it and running your test suite. That will not get rid of files on external storage, but it will clear out internal storage, so whether or not this is sufficiently a “clean slate” for you, I cannot say.
If those (or their combination) is insufficient, then you have no choice but to wipe out and restart the emulator. You can always purchase a faster development machine, or see if running the emulator in headless mode will speed up its launch.