How can I properly initialize my Android emulator using AVD?

130
May 09, 2022, at 7:10 PM

I'm trying to run an Android emulator from command-line because I couldn't run it from Android Studio (it gave the same problem plus some error messages such as "Time out after 300seconds waiting for emulator to come online" and "The emulator process for AVD was terminated").

When I run

emulator -avd flutter_emulator -no-snapshot-load -debug-init -logcat '*:v'

it shows a black emulator screen followed by some output in the terminal, ending with

VERBOSE | registered 'boot-properties' qemud service
VERBOSE | Adding boot property: 'ro.opengles.version' = '196608'
VERBOSE | Adding boot property: 'qemu.sf.fake_camera' = 'none'
VERBOSE | Adding boot property: 'qemu.adb.secure' = '1'
VERBOSE | Adding boot property: 'dalvik.vm.heapsize' = '512m'
VERBOSE | Adding boot property: 'qemu.hw.mainkeys' = '0'
VERBOSE | Adding boot property: 'qemu.sf.lcd_density' = '420'
INFO    | Rootcanal has  been activated.
VERBOSE | goldfish_events.have-dpad: false
VERBOSE | goldfish_events.have-trackball: false
VERBOSE | goldfish_events.have-camera: false
VERBOSE | goldfish_events.have-keyboard: false
VERBOSE | goldfish_events.have-lidswitch: true
VERBOSE | goldfish_events.have-tabletmode: false
VERBOSE | goldfish_events.have-touch: false
VERBOSE | goldfish_events.have-multitouch: false
VERBOSE | Adding boot property: 'net.wifi_mac_prefix' = '5554'
host doesn't support requested feature: CPUID.01H:EDX.apic [bit 9]
host doesn't support requested feature: CPUID.80000001H:EDX [bit 9]
host doesn't support requested feature: CPUID.80000001H:ECX.abm [bit 5]
VERBOSE | Not using any http proxy
VERBOSE | Adding boot property: 'qemu.timezone' = 'America/Sao_Paulo'
VERBOSE | android_hw_fingerprint_init: fingerprint qemud listen service initialized
INFO    | Started GRPC server at 127.0.0.1:8554, security: Local
INFO    | Advertising in: /run/user/1000/avd/running/pid_9223.ini

When I press the power button on emulator, the following contents are appended to the terminal:

INFO    | Critical: Failed to load https://maps.googleapis.com/maps/api/mapsjs/gen_204?csp_test=true: The 'Access-Control-Allow-Origin' header has a value 'qrc://' that is not equal to the supplied origin. Origin 'qrc://' is therefore not allowed access. (qrc:/html/js/common.js:0, (null))
INFO    | Critical: Failed to load https://maps.googleapis.com/maps/api/mapsjs/gen_204?csp_test=true: The 'Access-Control-Allow-Origin' header has a value 'qrc://' that is not equal to the supplied origin. Origin 'qrc://' is therefore not allowed access. (qrc:/html/js/common.js:0, (null))

After that, the emulator gets stuck with a black screen (at least I've waited for about an hour). How can I initialize it properly? Alternatively, can I change the source code anywhere to avoid connecting with the Google Maps API, if that's the problem?

What I've tried:

  • changing the hw.ramSize value on config.ini to values up to 2048MB

  • setting hw.gpu.enabled to "yes" and hw.gpu.mode to "host"

  • setting hw.gps to "no" (since the critical message refers to a Maps API)

The emulator gets stuck with this screen.

Outputs:

  • inxi -F:
System:    Host: computador Kernel: 4.15.0-167-generic x86_64 bits: 64
           Desktop: Cinnamon 3.8.9  Distro: Linux Mint 19 Tara
Machine:   Device: desktop Mobo: INTEL model: HM65DESK serial: N/A
           UEFI: American Megatrends v: 4.6.5 date: 02/23/2019
CPU:       Single core Intel Core i7-2640M (-UP-) cache: 4096 KB
           speed/max: 1596/3500 MHz
Graphics:  Card: Intel 2nd Generation Core Integrated Graphics Controller
           Display Server: x11 (X.Org 1.19.6 )
           drivers: modesetting (unloaded: fbdev,vesa)
           Resolution: 1920x1080@60.00hz
           OpenGL: renderer: Mesa DRI Intel HD Graphics 3000 (SNB GT2)
           version: 3.3 Mesa 20.0.8
Audio:     Card-1 Intel 6 Series/C200 Series Family High Def. Audio Controller
           driver: snd_hda_intel
           Card-2 Microsoft LifeCam VX-800 driver: USB Audio
           Sound: Advanced Linux Sound Architecture v: k4.15.0-167-generic
Network:   Card: Realtek RTL8111/8168/8411 PCIE Gigabit Ethernet Controller
           driver: r8169
           IF: enp2s0 state: up speed: 100 Mbps duplex: full
           mac: 0a:e0:af:b8:14:25
Drives:    HDD Total Size: 3060.6GB (8.0% used)
           ID-1: /dev/sda model: SATA_SSD size: 60.0GB
           ID-2: /dev/sdb model: ST3000NM0053 size: 3000.6GB
Partition: ID-1: / size: 55G used: 45G (86%) fs: ext4 dev: /dev/sda2
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 100.0C mobo: 27.8C
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 211 Uptime: 1:57 Memory: 3398.1/15929.4MB
           Client: Shell (bash) inxi: 2.3.56
  • emulator --version
Android emulator version 31.2.7.0 (build_id 8135630) (CL:N/A)
  • emulator -accel-check:
accel:
0
KVM (version 12) is installed and usable.
accel
Rent Charter Buses Company
READ ALSO
Android Studio - RecyclerView with API level 19 (API 19)

Android Studio - RecyclerView with API level 19 (API 19)

I need to use RecyclerView with API 19 (API level 19)

100
GMail composer links don't work on Android

GMail composer links don't work on Android

I am using GMail links like

108
junit.framework.AssertionFailedError: Expected<BuildersKt$flowOf$$inlined$unsafeFlow> but was:<kotlinx.coroutines.flow.SafeFlow>

junit.framework.AssertionFailedError: Expected<BuildersKt$flowOf$$inlined$unsafeFlow> but was:<kotlinx.coroutines.flow.SafeFlow>

I am trying to write android test cases for Room Dao, my return type is FlowI am getting the following error which I am not able to understand

155
Nested RecyclerView OnclickListener [closed]

Nested RecyclerView OnclickListener [closed]

Want to improve this question? Add details and clarify the problem by editing this post

111