[GH-ISSUE #170] Saving emulator state only works when device is a Samsung #122

Closed
opened 2026-03-01 15:40:43 +03:00 by kerem · 2 comments
Owner

Originally created by @rbaron on GitHub (Jul 8, 2019).
Original GitHub issue: https://github.com/budtmo/docker-android/issues/170

🐛 Bug Report

Operating System:
Linux - (Ubuntu 18.04.2 LTS @ digitalocean)

Docker Image:
budtmo/docker-android-x86-8.0 (but should affect all)

Docker Version:
18.09.6, build 481bc77

Docker-compose version (Only if you use it):
N/A.

Docker Command to start docker-android:
docker run -v $(pwd)/android_emulator_local_backup/.android:/root/.android -v $(pwd)/android_emulator_local_backup/android_emulator:/root/android_emulator -d --rm --privileged -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Nexus 5" -e EMULATOR_ARGS="-camera-back webcam0 -camera-front emulated" --name android-container budtmo/docker-android-x86-8.0

Expected Behavior

When running the docker container a second time (with quick boot enable and with volumes for /root/.android, /root/android_emulator), I expected that the previous emulator state (snapshot) would be used, so that the emulator would boot up faster.

Actual Behavior

The emulator seems to be destroyed and rebuilt every time. This causes the state to be lost and the boot process to take a longer time.

Preliminary investigation

It seems like the origin of this bug is this line, which explicitly check if the device name has samsung in it, and conditionally symlinks the config to /root/.android/devices.xml.
Then, whenever the container boots, there is a check for the existence of this symlink:

def is_initialized() -> bool:
    return os.path.exists(os.path.join(ROOT, '.android', 'devices.xml'))

This condition is then used to either boot an existing device or wipe any data and boot up a new one (source).

If I didn't miss any reason for this special treatment and removing the check for samsung sounds like a good fix, I'm happy to submit a pull request.

Originally created by @rbaron on GitHub (Jul 8, 2019). Original GitHub issue: https://github.com/budtmo/docker-android/issues/170 ## 🐛 Bug Report Operating System: Linux - (Ubuntu 18.04.2 LTS @ digitalocean) Docker Image: `budtmo/docker-android-x86-8.0` (but should affect all) Docker Version: `18.09.6, build 481bc77` Docker-compose version (Only if you use it): N/A. Docker Command to start docker-android: `docker run -v $(pwd)/android_emulator_local_backup/.android:/root/.android -v $(pwd)/android_emulator_local_backup/android_emulator:/root/android_emulator -d --rm --privileged -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Nexus 5" -e EMULATOR_ARGS="-camera-back webcam0 -camera-front emulated" --name android-container budtmo/docker-android-x86-8.0` ## Expected Behavior When running the docker container a second time (with quick boot enable and with volumes for `/root/.android`, `/root/android_emulator`), I expected that the previous emulator state (snapshot) would be used, so that the emulator would boot up faster. ## Actual Behavior The emulator seems to be destroyed and rebuilt every time. This causes the state to be lost and the boot process to take a longer time. ## Preliminary investigation It seems like the origin of this bug is [this line](https://github.com/budtmo/docker-android/blob/19e26a086b1480373df26c90d586c41b8ebb56f4/src/app.py#L84), which explicitly check if the device name has `samsung` in it, and conditionally symlinks the config to `/root/.android/devices.xml`. Then, whenever the container boots, there is a [check](https://github.com/budtmo/docker-android/blob/19e26a086b1480373df26c90d586c41b8ebb56f4/src/app.py#L53) for the existence of this symlink: ``` def is_initialized() -> bool: return os.path.exists(os.path.join(ROOT, '.android', 'devices.xml')) ``` This condition is then used to either boot an existing device or wipe any data and boot up a new one ([source](https://github.com/budtmo/docker-android/blob/19e26a086b1480373df26c90d586c41b8ebb56f4/src/app.py#L206)). If I didn't miss any reason for this special treatment and removing the check for `samsung` sounds like a good fix, I'm happy to submit a pull request.
kerem closed this issue 2026-03-01 15:40:43 +03:00
Author
Owner

@trinhpham commented on GitHub (Jul 11, 2019):

Agreed, @rbaron .
The code should check the created avd instead of that customized file.
You have my vote for a PR already :)

<!-- gh-comment-id:510326749 --> @trinhpham commented on GitHub (Jul 11, 2019): Agreed, @rbaron . The code should check the created avd instead of that customized file. You have my vote for a PR already :)
Author
Owner

@trinhpham commented on GitHub (Jul 11, 2019):

I still wonder if we can pre-initialize the emulator in the docker image to have a faster boot time.
Please share if you have an idea

<!-- gh-comment-id:510327218 --> @trinhpham commented on GitHub (Jul 11, 2019): I still wonder if we can pre-initialize the emulator in the docker image to have a faster boot time. Please share if you have an idea
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/docker-android#122
No description provided.