8

When creating an avd, starting it for the first time and then trying to close the emulator, the user will be prompted with a dialog reading:

Do you want to save the current state for the next quick boot?

Note: Saving the snapshot may take longer because free RAM is low.

I would like to save this parameter, before starting the emulated device, within its config.ini file.

However I'm not clear on which option it is.

Things I tried: Adding these lines to the config.ini

fastboot.chosenSnapshotFile=
fastboot.forceChosenSnapshotBoot=no
fastboot.forceColdBoot=no
fastboot.forceFastBoot=yes

Creating an additional file within the config.ini directory of the avd called quickbootChoice.ini that simply reads:

saveOnExit = true

Non of which helped, on every first shutdown of the emulated device this dialog pops up...

Thanks in advance

flaky
  • 6,816
  • 4
  • 29
  • 46
  • Have you found the answer? – Vulwsztyn May 19 '21 at 09:59
  • They decided to ask regardless of those settings if free ram is low https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emu/android/skin/qt/tool-window.cpp#1125 – yjh0502 Dec 04 '21 at 07:30
  • @yjh0502 any idea how to resolve this? My CI won't progress due to this dialog – StuStirling Mar 19 '22 at 00:18

3 Answers3

1

According to https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emu/android/skin/qt/tool-window.cpp the popup does not appear if the method returns based on this:

if (saveOnExitChoice == SaveSnapshotOnExit::Always &&
    (fc::isEnabled(fc::QuickbootFileBacked) ||
     (!savesWereSlow && !hasLowRam))) {
    return true;
}

Setting QuickbootFileBacked = on in .android/advancedFeatures.ini fixed it for me. See https://androidstudio.googleblog.com/2018/08/android-emulator-28.html.

C-Otto
  • 5,615
  • 3
  • 29
  • 62
1

If you are starting the emulator from the command line. Then provide the -no-snapshot-save parameter, to prevent it from saving.

emulator @Nexus_5X_API_23 -no-snapshot-save

reference: https://developer.android.com/studio/run/emulator-commandline

0

You can configure this setting in Android Studio, see this answer for instructions: Android emulator - Don't save state by default

Bill Mei
  • 717
  • 1
  • 10
  • 22
  • 3
    I do not want to use Android Studio for this. Imagine being on a CI Server and wanting to run emulator tests. – flaky Sep 10 '20 at 11:24