Android avd emulator - how to save "Do you want to save the current state for the next quick boot?" in config.ini file
Asked Answered
B

3

9

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

Blowfish answered 12/2, 2020 at 11:38 Comment(3)
Have you found the answer?Quirinal
They decided to ask regardless of those settings if free ram is low android.googlesource.com/platform/external/qemu/+/refs/heads/…Adah
@Adah any idea how to resolve this? My CI won't progress due to this dialogDowney
A
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.

Allusion answered 12/5, 2022 at 15:12 Comment(0)
I
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

Impoverish answered 7/10, 2022 at 17:55 Comment(0)
G
0

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

Getty answered 9/9, 2020 at 22:34 Comment(1)
I do not want to use Android Studio for this. Imagine being on a CI Server and wanting to run emulator tests.Blowfish

© 2022 - 2025 — McMap. All rights reserved.