android-emulator-container-scripts icon indicating copy to clipboard operation
android-emulator-container-scripts copied to clipboard

Emulator persistence issue

Open kovalbogdan95 opened this issue 4 years ago • 1 comments

Is there a way to save data between container restarts?

I didn't found any mention of it. I guess it should be as simple as add a volume to the docker-compose.yml file and mount it somewhere in the container (I actually have no idea where).

If it's actually possible - it will be great to add info about it to the documentation.

I'm using the emulator with web access on my local machine. I tried to restart the same container but I got an error in the emulator container. So for me, only the first run is successful.

emulator_emulator | pulse: (   0.005|   0.000) D: [pulseaudio] protocol-native.c: Enabling srbchannel...
emulator_emulator | pulse: (   0.006|   0.000) D: [pulseaudio] protocol-native.c: Client enabled srbchannel.
emulator_emulator | pulse: (   0.006|   0.000) I: [pulseaudio] client.c: Freed 0 "pactl"
emulator_emulator | pulse: (   0.006|   0.000) I: [pulseaudio] protocol-native.c: Connection died.
emulator_emulator | * daemon started successfully
emulator_emulator | COMMAND: exec emulator/emulator -avd Pixel2 -ports 5556,5557 -grpc 8554 -no-window -skip-adb-auth -no-boot-anim -shell-serial file:/tmp/android-unknown/kernel.log -logcat-output /tmp/android-unknown/logcat.log -feature AllowSnapshotMigration -gpu swiftshader_indirect -shell-serial file:/tmp/android-unknown/kernel.log -logcat-output /tmp/android-unknown/logcat.log -qemu -append panic=1
emulator_emulator | emulator: ERROR: A snapshot operation for 'Pixel2' is pending and timeout has expired. Exiting...
emulator_emulator | 
emulator_emulator exited with code 1

(After container rebuild I can run the emulator again and it will be in a 'clean' state. I tried to build a container without -no-snapshot-save -wipe-data but it didn't help either.

Thank you! :+1:

kovalbogdan95 avatar Mar 05 '21 21:03 kovalbogdan95

I just submitted a PR https://github.com/google/android-emulator-container-scripts/pull/262 which fixed the undefined ANDROID_AVD_HOME so the function cleanup will properly cleanup the lock files before every start.

docker-compose.yaml under emulator_emulator

   volumes:
      - /host/path/you/want:/data

I only removed -wipe-data but not -no-snapshot-save.

My question would be how to gracefully stop the emulator_emulator so the lockfiles could be properly deleted?

spff avatar Jul 18 '21 04:07 spff