amrsa1 / Android-Emulator-image

The use of this Docker image simplifies the process of running an Android emulator within a Docker container
MIT License
113 stars 52 forks source link

emulator can't recover from container restart #20

Closed dorsegal closed 8 months ago

dorsegal commented 8 months ago

I am running using docker-compose.yaml and I have added restart: unless-stopped option so it will restart in case something happens. When there is a crash for whatever reason container is being restarted but emulator can't start. it is just hangs till timeout image

my docker-compose:

image
amrsa1 commented 8 months ago

But it looks like emulator didnt crash. It was fully booted according to you screenshot and moved to next step which is launching appium.

So i would ask you to remove the restart option and see how it will behave.

dorsegal commented 8 months ago

I was a simulating a crash right after appium was starting.

amrsa1 commented 8 months ago

But it looks like emulator didnt crash. It was fully booted according to you screenshot and moved to next step which is launching appium

Try to run the command manually and see the output

dorsegal commented 8 months ago

The way I simulated a crash:

  1. docker exec -it android bash
  2. apt update && apt install -y procps
  3. ps aux
  4. kill -9 {emulator PID}
amrsa1 commented 8 months ago

The way I simulated a crash:

  1. docker exec -it android bash
  2. apt update && apt install -y procps
  3. ps aux
  4. kill -9 {emulator PID}

Try aslo to kill the adb server, before starting the emulator after being crashed

dorsegal commented 8 months ago

I found the issue. After checking emulator logs I see this error: Running multiple emulators with the same AVD is an experimental feature.

https://stackoverflow.com/questions/55328499/emulator-emulator-error-running-multiple-emulators-with-the-same-avd-is-an-ex

the solution I did was adding this line to start_emu_headless.sh: rm ~/.android/avd/*.avd/*.lock

amrsa1 commented 8 months ago

I found the issue. After checking emulator logs I see this error: Running multiple emulators with the same AVD is an experimental feature.

https://stackoverflow.com/questions/55328499/emulator-emulator-error-running-multiple-emulators-with-the-same-avd-is-an-ex

the solution I did was adding this line to start_emu_headless.sh: rm ~/.android/avd/*.avd/*.lock

Awesome Gald that you have solved it.

I think also killing adb server will eliminate the first one so you wont have problem running another with same name.