[GH-ISSUE #129] Back & Restore avd not working #89

Open
opened 2026-03-01 15:40:19 +03:00 by kerem · 5 comments
Owner

Originally created by @omritoptix on GitHub (Nov 12, 2018).
Original GitHub issue: https://github.com/budtmo/docker-android/issues/129

Operating System:
Ubuntu 18.04

Docker Image:
butomo1989/docker-android-x86-7.1.1

Docker Version:
17.12.1-ce

Docker-compose version (Only if you use it):
1.22.0

Docker Command to start docker-android:
docker-compose up --build -d

Expected Behavior

I installed an apk on a fresh avd.
I expected the former avd to be used (with the installed apk) once I restart docker compose with
docker-compose stop && echo 'y' | docker-compose rm && docker-compose up --build -d

Actual Behavior

The avd is initialized from scratch again and doesn't include the previously installed apk.

docker compose file

# Note: It requires docker-compose 1.13.0
#
# Usage: docker-compose up -d
version: "2.2"

services:
  # Docker-Android for Android application testing
  nexus_7.1.1:
    image: butomo1989/docker-android-x86-7.1.1
    container_name: appium_emulator_1
    privileged: true
    # Increase scale number if needed
    scale: 1
    ports:
      - 6080
    # Change path of apk that you want to test. I use sample_apk that I provide in folder "example"
    volumes:
      - ./video-nexus_7.1.1:/tmp/video
      - ./local_backup/.android:/root/.android
      - ./local_backup/android_emulator:/root/android_emulator
    environment:
      - DEVICE=Nexus 5
      - CONNECT_TO_GRID=true
      - APPIUM=true
      - SELENIUM_HOST=selenium_hub
      - AUTO_RECORD=true

Update:

it seems like the file devices.xml is not created under the .android directory which causes the is_initialized() function to return False

Originally created by @omritoptix on GitHub (Nov 12, 2018). Original GitHub issue: https://github.com/budtmo/docker-android/issues/129 Operating System: Ubuntu 18.04 Docker Image: butomo1989/docker-android-x86-7.1.1 Docker Version: 17.12.1-ce Docker-compose version (Only if you use it): 1.22.0 Docker Command to start docker-android: docker-compose up --build -d ## Expected Behavior I installed an apk on a fresh avd. I expected the former avd to be used (with the installed apk) once I restart docker compose with ``` docker-compose stop && echo 'y' | docker-compose rm && docker-compose up --build -d``` ## Actual Behavior The avd is initialized from **scratch** again and doesn't include the previously installed apk. ## docker compose file ``` # Note: It requires docker-compose 1.13.0 # # Usage: docker-compose up -d version: "2.2" services: # Docker-Android for Android application testing nexus_7.1.1: image: butomo1989/docker-android-x86-7.1.1 container_name: appium_emulator_1 privileged: true # Increase scale number if needed scale: 1 ports: - 6080 # Change path of apk that you want to test. I use sample_apk that I provide in folder "example" volumes: - ./video-nexus_7.1.1:/tmp/video - ./local_backup/.android:/root/.android - ./local_backup/android_emulator:/root/android_emulator environment: - DEVICE=Nexus 5 - CONNECT_TO_GRID=true - APPIUM=true - SELENIUM_HOST=selenium_hub - AUTO_RECORD=true ``` ## Update: it seems like the file `devices.xml` is not created under the `.android` directory which causes the ```is_initialized()``` function to return ```False```
Author
Owner

@cesarandreslopez commented on GitHub (May 17, 2019):

The same issue is seen here too. Did you ever get to fix it? @omritoptix

<!-- gh-comment-id:493307561 --> @cesarandreslopez commented on GitHub (May 17, 2019): The same issue is seen here too. Did you ever get to fix it? @omritoptix
Author
Owner

@cesarandreslopez commented on GitHub (May 17, 2019):

A bit more data in case anyone else encounters this issue. I've found that if before stopping and rm the container I turn off the emulator phone on novnc, this issue goes away.

<!-- gh-comment-id:493316051 --> @cesarandreslopez commented on GitHub (May 17, 2019): A bit more data in case anyone else encounters this issue. I've found that if before stopping and rm the container I turn off the emulator phone on novnc, this issue goes away.
Author
Owner

@K4W1H0R53 commented on GitHub (Jun 29, 2019):

same issue as above, i try to use docker volume, but it still not save any changes in avd every time i restart/stop the container.

<!-- gh-comment-id:506950465 --> @K4W1H0R53 commented on GitHub (Jun 29, 2019): same issue as above, i try to use docker volume, but it still not save any changes in avd every time i restart/stop the container.
Author
Owner

@cleancoderob commented on GitHub (Dec 31, 2019):

In the file src/app.py there is a lookup for 'hw.device.name={}', however in the config file for my emulator (Nexus 5), there are spaces around the equals sign. I changed it to 'hw.device.name = {}' and then re-built the image. It now works fine for me, remembering the avd state.

<!-- gh-comment-id:569979031 --> @cleancoderob commented on GitHub (Dec 31, 2019): In the file src/app.py there is a lookup for 'hw.device.name={}', however in the config file for my emulator (Nexus 5), there are spaces around the equals sign. I changed it to 'hw.device.name = {}' and then re-built the image. It now works fine for me, remembering the avd state.
Author
Owner

@cleancoderob commented on GitHub (Jan 9, 2020):

The spacing issue appears to depend on the API version. I moved from API 27, where the spaces were needed, back to API 23, where the spaces must be removed.

<!-- gh-comment-id:572703247 --> @cleancoderob commented on GitHub (Jan 9, 2020): The spacing issue appears to depend on the API version. I moved from API 27, where the spaces were needed, back to API 23, where the spaces must be removed.
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#89
No description provided.