budtmo / docker-android

Android in docker solution with noVNC supported and video recording
Other
9.57k stars 1.27k forks source link

Emulator does not start with provided config.ini #242

Open thomas-coinjar opened 4 years ago

thomas-coinjar commented 4 years ago

🐛 Bug Report

Operating System: Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-46-generic x86_64)

Docker Image: budtmo/docker-android-x86-9.0

Docker Version:
19.03.8, build afacb8b7f0

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

Docker Command to start docker-android:
docker run -ti --privileged -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Nexus 6p" -e EMULATOR_ARGS="-partition-size 2048" --name android-container 8c1d688c8918 /bin/bash

Expected Behavior

I run the following bash script

adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'

mkdir -p /root/.android/avd
ln -s /root/android_emulator /root/.android/avd/nexus_6p_9.0.avd

echo '
hw.lcd.width=1080
hw.lcd.height=1920
hw.ramSize=4096
vm.heapSize=576
hw.gps=no
hw.accelerometer=no
hw.audioInput=no
hw.audioOutput=no
hw.battery=no
disk.dataPartition.size=2048M
hw.mainKeys=true' >> /root/.android/avd/nexus_6p_9.0.avd/config.ini

Here the log

Using Emulator
[539] [ INFO] app - Android version: 9.0 
API level: 28 
Processor: x86 
System image: x86 
Image type: google_apis
[539] [ INFO] app - Device: Nexus 6P
[539] [ INFO] app - Custom Args: -partition-size 2048
[539] [ INFO] app - AVD name: nexus_6p_9.0
[539] [ INFO] app - No config file file was found at /root/android_emulator/config.ini. Assuming new device.
[539] [ INFO] app - Preparing emulator...
[539] [ INFO] app - Command to create avd: avdmanager create avd -f -n nexus_6p_9.0 -b google_apis/x86 -k "system-images;android-28;google_apis;x86" -d Nexus\ 6P -p /root/android_emulator
[539] [ INFO] app - Skin was added in config.ini
[539] [ INFO] app - Run emulator...
[539] [ INFO] app - Emulator was not previously initialized. Preparing a new one...

As shown in the log, because it can't find the /root/android_emulator/config.ini it is Preparing a new one

The latter command produces the following config.ini file:

avd.ini.encoding=UTF-8
abi.type=x86
hw.accelerometer=yes
hw.audioInput=yes
hw.battery=yes
hw.cpu.arch=x86
hw.dPad=no
hw.device.hash2=MD5:9b564b60b1aebee32c73ded9daa1e620
hw.device.manufacturer=Google
hw.device.name=Nexus 6P
hw.gps=yes
hw.keyboard=no
hw.lcd.density=560
hw.mainKeys=no
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no
image.sysdir.1=system-images/android-28/google_apis/x86/
tag.display=Google APIs
tag.id=google_apis
skin.path=/root/devices/skins/nexus_6p
disk.dataPartition.size=550m
hw.lcd.width=1080
hw.lcd.height=1920
hw.ramSize=4096
vm.heapSize=576
hw.gps=no
hw.accelerometer=no
hw.audioInput=no
hw.audioOutput=no
hw.battery=no
disk.dataPartition.size=2048M
hw.mainKeys=true

Actual Behavior

If I copy the above config.ini file into the /root/android_emulator/ directory and just restart the script below

adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'

mkdir -p /root/.android/avd
ln -s /root/android_emulator /root/.android/avd/nexus_6p_9.0.avd

the emulator won't start and hangs with the log Using previously initialized AVD...

Using Emulator
[147] [ INFO] app - Android version: 9.0 
API level: 28 
Processor: x86 
System image: x86 
Image type: google_apis
[147] [ INFO] app - Device: Nexus 6P
[147] [ INFO] app - Custom Args: -partition-size 2048
[147] [ INFO] app - AVD name: nexus_6p_9.0
[147] [ INFO] app - Found existing config file at /root/android_emulator/config.ini.
[147] [ INFO] app - Existing config file references Nexus 6P. Assuming device was previously initialized.
[147] [ INFO] app - Run emulator...
[147] [ INFO] app - Using previously initialized AVD...
mmbug commented 3 years ago

how to set custom config.ini? echoing to config.ini is the only way?