Android Studio emulator: ERROR: detected a hanging thread QEMU2 main loop - android-emulator

I use Android Studio 3.0.1 on Ubuntu 16.04.
Yesterday, Android Studio popped up a message saying that there's an update available, and I always click those. It then notified me that it had successfully updated the emulator.
My AVD worked perfectly before, but after the update finished, now when I launch it, it shows a black screen in the emulator window for 15 seconds and then crashes with the following error message:
ERROR: detected a hanging thread 'QEMU2 main loop'. No response for 15000 ms
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
I tried the solutions suggested in all the threads describing similar emulator problems. (I verified that the emulator is still installed via the SDK Manager, I tried switching between the software and the hardware graphics settings of the AVD, I tried replacing libstdc++ with a newer version 6.0.24, I tried instead to ln -sf my /usr/lib.. libstdc++ 6.0.21 into the SDK emulator lib64/libstdc++ folder, I even downloaded Android Studio and ran a fresh installation with its own new SDK folder with freshly downloaded SDKs, I tried creating new AVDs with different architectures (arm) and different API levels (24, 27), I tried restarting ADB, and even restarting the computer. Nothing helped.
My SDK tools menu doesn't have an entry for emulator accelerator (HAXM), though my PC has an Intel CPU: I shouldn't have to change this since my AVD worked just yesterday! What broke?
What's causing the 'QEMU2 main loop' to hang, and how can I fix it?

This is what worked for me:
I have gone to Tools->AVD Manager->Edit(The particular emulator)>Show Advanced Settings
Then in the Emulated Performance section i had the Quick Boot selected, which i changed to Cold Boot and everything started working fine.
Hope this helps.

I found an interim workaround - make sure IPv6 is enabled.
$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6
0
If you see 1 above, edit your /etc/sysctl.conf file and comment out all the IPv6 disable directives:
# net.ipv6.conf.all.disable_ipv6 = 1
# net.ipv6.conf.default.disable_ipv6 = 1
# net.ipv6.conf.lo.disable_ipv6 = 1
Update Jan 5, '18: At least one user reports that disabling a previously enabled IPv6 has resolved the problem on his system. In that case, you may want to try to reverse the steps above if IPv6 is already enabled on your system and the emulator does not start.
I started experiencing the exact same problem after the most recent update of the Android SDK on my Ubuntu 16.04. The executable doesn't have symbols so I'm not sure how to point the original developer to the root cause, but here is the threads state:
(gdb) info threads
Id Target Id Frame
1 Thread 0x7f6d20428700 (LWP 14472) 0x00000000014e8baf in ?? ()
2 Thread 0x7f6d20c29700 (LWP 14471) syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
* 3 Thread 0x7f6d20c2ad00 (LWP 14470) 0x00007f6d258a27d1 in __GI_ppoll (fds=0x3842bf8, nfds=1, timeout=<optimized out>, sigmask=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:50
4 Thread 0x7f6d1d427700 (LWP 14479) pthread_cond_wait##GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
5 Thread 0x7f6d1649b700 (LWP 14483) pthread_cond_wait##GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
6 Thread 0x7f6d05fe4700 (LWP 14487) __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
7 Thread 0x7f6d16c9c700 (LWP 14482) __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
8 Thread 0x7f6d1cc26700 (LWP 14480) pthread_cond_wait##GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
9 Thread 0x7f6d1eda9700 (LWP 14478) 0x00007f6d258a270d in poll () at ../sysdeps/unix/syscall-template.S:84
10 Thread 0x7f6d067e5700 (LWP 14486) 0x00007f6d280107cd in connect () at ../sysdeps/unix/syscall-template.S:84
11 Thread 0x7f6d15c9a700 (LWP 14484) 0x00007f6d258a27d1 in __GI_ppoll (fds=0x7f6d10000aa0, nfds=5, timeout=<optimized out>, sigmask=0x0)
at ../sysdeps/unix/sysv/linux/ppoll.c:50
12 Thread 0x7f6cff7fe700 (LWP 14489) pthread_cond_wait##GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
13 Thread 0x7f6cfffff700 (LWP 14488) 0x00007f6d258a270d in poll () at ../sysdeps/unix/syscall-template.S:84
14 Thread 0x7f6cfeffd700 (LWP 14490) pthread_cond_wait##GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
15 Thread 0x7f6cfe7fc700 (LWP 14492) 0x00007f6d280107cd in connect () at ../sysdeps/unix/syscall-template.S:84
16 Thread 0x7f6cfdffb700 (LWP 14493) 0x00007f6d258a27d1 in __GI_ppoll (fds=0x7f6c78012818, nfds=3, timeout=<optimized out>, sigmask=0x0)
at ../sysdeps/unix/sysv/linux/ppoll.c:50
17 Thread 0x7f6c93dfe700 (LWP 14498) pthread_cond_wait##GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
Log output:
emulator:Android emulator version 26.0.3.0 (build_id 3965150)
emulator:Found AVD name 'Nexus_5X_API_25'
emulator:Found AVD target architecture: x86_64
emulator:argv[0]: './emulator'; program directory: '/home/sl/opt/android-sdk/tools'
emulator: Found directory: /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64/
emulator:Probing for /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//kernel-ranchu: file exists
emulator:Auto-config: -engine qemu2 (based on configuration)
emulator: Found directory: /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64/
emulator:try dir /home/sl/opt/android-sdk/tools
emulator:try dir ./
emulator:try dir ../emulator
emulator:Found target-specific 64-bit emulator binary: /home/sl/opt/android-sdk/tools/../emulator/qemu/linux-x86_64/qemu-system-x86_64
emulator:Adding library search path: '../emulator/lib64'
emulator:Adding library search path: '../emulator/lib64/gles_swiftshader'
emulator:Adding library search path: '../emulator/lib64/gles_angle'
emulator:Adding library search path: '../emulator/lib64/gles_angle9'
emulator:Adding library search path: '../emulator/lib64/gles_angle11'
emulator:Adding library search path: '../emulator/lib64/libstdc++'
emulator: Adding library search path for Qt: '../emulator/lib64/qt/lib'
emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=../emulator/lib64/qt/plugins
emulator: Running :/home/sl/opt/android-sdk/tools/../emulator/qemu/linux-x86_64/qemu-system-x86_64
emulator: qemu backend: argv[00] = "/home/sl/opt/android-sdk/tools/../emulator/qemu/linux-x86_64/qemu-system-x86_64"
emulator: qemu backend: argv[01] = "-avd"
emulator: qemu backend: argv[02] = "Nexus_5X_API_25"
emulator: qemu backend: argv[03] = "-verbose"
emulator: Concatenated backend parameters:
/home/sl/opt/android-sdk/tools/../emulator/qemu/linux-x86_64/qemu-system-x86_64 -avd Nexus_5X_API_25 -verbose
emulator: Android virtual device file at: /home/sl/.android/avd/Nexus_5X_API_25.ini
emulator: virtual device content at /home/sl/.android/avd/Nexus_5X_API_25.avd
emulator: virtual device config file: /home/sl/.android/avd/Nexus_5X_API_25.avd/config.ini
emulator: using core hw config path: /home/sl/.android/avd/Nexus_5X_API_25.avd/hardware-qemu.ini
emulator: using snapshot lock path: /home/sl/.android/avd/Nexus_5X_API_25.avd/snapshot.lock
emulator: Found AVD target API level: 25
emulator: Read property file at /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//build.prop
emulator: No boot.prop property file found.
emulator: Warning: config.ini contains invalid skin.path entry: _no_skin
emulator: autoconfig: -skin 1080x1920
emulator: autoconfig: -skindir (null)
emulator: autoconfig: -kernel /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//kernel-ranchu
emulator: Target arch = 'x86_64'
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//ramdisk.img
emulator: Using initial system image: /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//system.img
emulator: No vendor image
emulator: autoconfig: -data /home/sl/.android/avd/Nexus_5X_API_25.avd/userdata-qemu.img
emulator: autoconfig: -initdata /home/sl/.android/avd/Nexus_5X_API_25.avd/userdata.img
emulator: autoconfig: -cache /home/sl/.android/avd/Nexus_5X_API_25.avd/cache.img
emulator: Physical RAM size: 1536MB
emulator: VM heap size 256MB is below hardware specified minimum of 384MB,setting it to that value
emulator: System image is read only
emulator: Found 1 DNS servers: 127.0.1.1
emulator: found magic skin width=1080 height=1920 bpp=16
emulator: CPU Acceleration: working
emulator: CPU Acceleration status: KVM (version 12) is installed and usable.
emulator: GPU emulation enabled using 'host' mode
emulator: Initializing hardware OpenGLES emulation support
emulator: Found 1 DNS servers: 127.0.1.1
Content of hardware configuration file:
hw.cpu.arch = x86_64
hw.cpu.ncore = 2
hw.ramSize = 1536
hw.screen = multi-touch
hw.mainKeys = false
hw.trackBall = false
hw.keyboard = true
hw.keyboard.lid = false
hw.keyboard.charmap = qwerty2
hw.dPad = false
hw.rotaryInput = false
hw.gsmModem = true
hw.gps = true
hw.battery = true
hw.accelerometer = true
hw.gyroscope = true
hw.audioInput = true
hw.audioOutput = true
hw.sdCard = false
disk.cachePartition = true
disk.cachePartition.path = /home/sl/.android/avd/Nexus_5X_API_25.avd/cache.img
disk.cachePartition.size = 66m
hw.lcd.width = 1080
hw.lcd.height = 1920
hw.lcd.depth = 16
hw.lcd.density = 420
hw.lcd.backlight = true
hw.gpu.enabled = true
hw.gpu.mode = host
hw.gpu.blacklisted = no
hw.initialOrientation = Portrait
hw.camera.back = none
hw.camera.front = none
vm.heapSize = 384
hw.sensors.light = true
hw.sensors.pressure = true
hw.sensors.humidity = true
hw.sensors.proximity = true
hw.sensors.magnetic_field = true
hw.sensors.magnetic_field_uncalibrated = true
hw.sensors.gyroscope_uncalibrated = true
hw.sensors.orientation = true
hw.sensors.temperature = true
hw.useext4 = true
hw.arc = false
hw.arc.autologin = false
kernel.path = /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//kernel-ranchu
kernel.newDeviceNaming = yes
kernel.supportsYaffs2 = no
disk.ramdisk.path = /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//ramdisk.img
disk.systemPartition.initPath = /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//system.img
disk.systemPartition.size = 2765m
disk.vendorPartition.size = 0
disk.dataPartition.path = /home/sl/.android/avd/Nexus_5X_API_25.avd/userdata-qemu.img
disk.dataPartition.size = 800m
disk.encryptionKeyPartition.path = /home/sl/.android/avd/Nexus_5X_API_25.avd/encryptionkey.img
PlayStore.enabled = false
avd.name = Nexus_5X_API_25
fastboot.forceColdBoot = false
.
QEMU options list:
emulator: argv[00] = "/home/sl/opt/android-sdk/tools/../emulator/qemu/linux-x86_64/qemu-system-x86_64"
emulator: argv[01] = "-dns-server"
emulator: argv[02] = "127.0.1.1"
emulator: argv[03] = "-serial"
emulator: argv[04] = "null"
emulator: argv[05] = "-device"
emulator: argv[06] = "goldfish_pstore,addr=0xff018000,size=0x10000,file=/home/sl/.android/avd/Nexus_5X_API_25.avd/data/misc/pstore/pstore.bin"
emulator: argv[07] = "-cpu"
emulator: argv[08] = "android64"
emulator: argv[09] = "-enable-kvm"
emulator: argv[10] = "-smp"
emulator: argv[11] = "cores=2"
emulator: argv[12] = "-m"
emulator: argv[13] = "1536"
emulator: argv[14] = "-lcd-density"
emulator: argv[15] = "420"
emulator: argv[16] = "-object"
emulator: argv[17] = "iothread,id=disk-iothread"
emulator: argv[18] = "-nodefaults"
emulator: argv[19] = "-kernel"
emulator: argv[20] = "/home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//kernel-ranchu"
emulator: argv[21] = "-initrd"
emulator: argv[22] = "/home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//ramdisk.img"
emulator: argv[23] = "-drive"
emulator: argv[24] = "if=none,index=0,id=system,file=/home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//system.img,read-only"
emulator: argv[25] = "-device"
emulator: argv[26] = "virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify"
emulator: argv[27] = "-drive"
emulator: argv[28] = "if=none,index=1,id=cache,file=/home/sl/.android/avd/Nexus_5X_API_25.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[29] = "-device"
emulator: argv[30] = "virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify"
emulator: argv[31] = "-drive"
emulator: argv[32] = "if=none,index=2,id=userdata,file=/home/sl/.android/avd/Nexus_5X_API_25.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[33] = "-device"
emulator: argv[34] = "virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify"
emulator: argv[35] = "-drive"
emulator: argv[36] = "if=none,index=3,id=encrypt,file=/home/sl/.android/avd/Nexus_5X_API_25.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[37] = "-device"
emulator: argv[38] = "virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify"
emulator: argv[39] = "-netdev"
emulator: argv[40] = "user,id=mynet"
emulator: argv[41] = "-device"
emulator: argv[42] = "virtio-net-pci,netdev=mynet"
emulator: argv[43] = "-show-cursor"
emulator: argv[44] = "-L"
emulator: argv[45] = "/home/sl/opt/android-sdk/emulator/lib/pc-bios"
emulator: argv[46] = "-soundhw"
emulator: argv[47] = "hda"
emulator: argv[48] = "-vga"
emulator: argv[49] = "none"
emulator: argv[50] = "-append"
emulator: argv[51] = "qemu=1 androidboot.hardware=ranchu clocksource=pit android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.encrypt=1 qemu.opengles.version=131072 cma=288M qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/sys/bus/platform/devices/ANDR0001:00/properties/android/ ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000"
emulator: argv[52] = "-android-hw"
emulator: argv[53] = "/home/sl/.android/avd/Nexus_5X_API_25.avd/hardware-qemu.ini"
Concatenated QEMU options:
/home/sl/opt/android-sdk/tools/../emulator/qemu/linux-x86_64/qemu-system-x86_64 -dns-server 127.0.1.1 -serial null -device goldfish_pstore,addr=0xff018000,size=0x10000,file=/home/sl/.android/avd/Nexus_5X_API_25.avd/data/misc/pstore/pstore.bin -cpu android64 -enable-kvm -smp cores=2 -m 1536 -lcd-density 420 -object iothread,id=disk-iothread -nodefaults -kernel /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//kernel-ranchu -initrd /home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//ramdisk.img -drive if=none,index=0,id=system,file=/home/sl/opt/android-sdk/system-images/android-25/google_apis/x86_64//system.img,read-only -device virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify -drive if=none,index=1,id=cache,file=/home/sl/.android/avd/Nexus_5X_API_25.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify -drive if=none,index=2,id=userdata,file=/home/sl/.android/avd/Nexus_5X_API_25.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify -drive if=none,index=3,id=encrypt,file=/home/sl/.android/avd/Nexus_5X_API_25.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify -netdev user,id=mynet -device virtio-net-pci,netdev=mynet -show-cursor -L /home/sl/opt/android-sdk/emulator/lib/pc-bios -soundhw hda -vga none -append 'qemu=1 androidboot.hardware=ranchu clocksource=pit android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.encrypt=1 qemu.opengles.version=131072 cma=288M qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/sys/bus/platform/devices/ANDR0001:00/properties/android/ ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000' -android-hw /home/sl/.android/avd/Nexus_5X_API_25.avd/hardware-qemu.ini
emulator: Android qemu version 27.0.2.0 (build_id 4498654) (CL:f388734068bae38c6115263feea33c68eed531fe)
emulator: Starting QEMU main loop
emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'ro.opengles.version' = '131072'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'none'
emulator: Adding boot property: 'dalvik.vm.heapsize' = '384m'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '0'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '420'
emulator: goldfish_events.have-dpad: false
emulator: goldfish_events.have-trackball: false
emulator: goldfish_events.have-camera: false
emulator: goldfish_events.have-keyboard: true
emulator: goldfish_events.have-lidswitch: false
emulator: goldfish_events.have-tabletmode: false
emulator: goldfish_events.have-touch: false
emulator: goldfish_events.have-multitouch: true
emulator: control console listening on port 5554, ADB on port 5555
Not using any http proxy
emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized
emulator: Warning: config.ini contains invalid skin.path entry: _no_skin
emulator: ERROR: detected a hanging thread 'QEMU2 main loop'. No response for 15000 ms

RELAX guys!
Actually hanging state may occur
at starting of emulator
during the run
and this may be after
updating packages
when you import or open a project into higher version of android studio like
2.4 -> 3.0.1 etc
the main reason is that your previous app's state is saved with previous libraries and packages of android studio, So to solve this error is easy i.e
a) Tools->AVD->Edit->advanced settings. choose quick boot instead of cold boot
(as answered by Kamel)
OR
b) if you already chosen 'Quick boot' then choose 'Cold boot', and restart
emulator, it will work fine.

We were running 27 emulators on a 28 core machine very happily until 1 Dec 2020, when abruptly they started running slowly with a load average 1.5x - 2x worse and these QEMU messages, with occasional days when it returned to normal. Another team also running Android 10 on their emulators also saw the same performance problems on their completely unrelated system. Android 11 and Pie are unaffected.
Our emulator containers are cooked with standard avdmanager-created AVDs and a machine snapshot into docker images, one emulator per image, and we wake up several of these containers.
We still don't entirely understand the cause, but we seem to have solved it by disabling various settings and applications inside the AVD; the snapshot images without these fixes still behave badly. We're not sure which one actually fixed it so I'll list everything here even if it seems unlikely to contribute; if we do determine that, I'll update this answer:
512M sdcard (-c option to avdmanager)
pm revoke RECORD_AUDIO for Quicksearch (googlequicksearchbox = Velvet)
su root pm disable com.google.android.googlequicksearchbox
su root pm disable com.google.android.music
Settings > Security > Play protect > disable scan device
App Info > Play services > clear storage, clear cache, force stop
App Info > Google Auto > Disable
Opened maps briefly, skip sign-in, and click 'zoom to location'
Normal 'dismiss first time user' stuff like:
granting camera permissions, not saving location
not sharing any stats or logging in (=No thanks) to Chrome, force-killing it to try to provoke the data-saver screen, and starting Chrome back up.
Also, Chrome > Settings > Lite mode > turn on, turn off
and tapping in a text window to bring up the keyboard, clearing the 'help build a better keyboard' stuff.
Checking data/data/com.google.android.inputmethod.latin/shared_prefs/com.googe.android.inputmethod.latin_preferences.xml for the naughty words - we didn't see the naughty word lists, while we were building the 'let's try this again' image.
Accidentally tapped on the quicksearch widget and enabled it; disabled it again.
We also a couple of hours doing this - in case it downloaded something before we stopped the emulator and made it take a snapshot.
we still find that Android 10 and Android 11 run 10% slower than Pie, even with these bodges.

Enabling/disabling ipv6 protocol on macOS also works, in case that the off option doesn't appear in the Configure IPv6 dropdown (like in macOS 10.14), you can perform the next commands in the terminal:
networksetup -setv6off Ethernet && networksetup -setv6off Wi-Fi
To enable just select the previous selected option in the Configure IPv6 dropdown or perform this other command:
networksetup -setv6automatic Wi-Fi && networksetup -setv6automatic Ethernet

i had exactly the same problem, in ubuntu 16.04 and android studio 3.0.1
after a bit googling with this error message:
ADB rejected shell command (getprop): closed
i found a user in the Arch forumn that discussed the error.
an easy solution is: after click on the AVD Manager in AS > click on Edit this AVD with a pencil icon > in Graphics dropdown menu choose Software.
this mode maybe cause to decreasing emulator speed but can be a temporary solution for the problem.

Go to Tools => AVD Manager select Virtual Device which you want to open Press the pen icon (Edit this AVD)
Select Show Advanced Settings
Select Boot option : Cold boot

On:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
To set the value of disable_ipv6 from 1 to 0, the following worked for me:
$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6
1
$ sudo sysctl net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.all.disable_ipv6 = 0
$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6
0

I have resolved this problem.
Just check in your SDK manager are there any updates available. If yes then update the AVD manager and SDK tools.
Then start your AVD. It will work as before.

in Tools->AVD->Edit->advanced settings. choose quick boot instead of cold boot

I am running Android Studio 3.01 in Windows.
I don't know if this has anything to do with it. I got the same error message:
Android Studio emulator: ERROR: detected a hanging thread QEMU2 main loop
I place a try around the statement. Here is the trace I got:
Process: com.abc.abc, PID: 4620
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abc.abc/com.abc.abc.CheckRegistration}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0:
You must supply a layout_width attribute.
I replace my domain by abc on the message above.
I change the layout width from “wrap_content” to specific width 123dp. This change solved my problem.

Related

unexpected system image feature string, emulator might not function correctly, please try updating the emulator

I Created an Emulator on Windows 10 without Installing Android Studio. But when I try to launch it, I get this error. Please help me. How can I fix this..?
C:\Users\This pc\AppData\Local\android\emulator>emulator -avd nexus
INFO | Android emulator version 31.2.10.0 (build_id 8420304) (CL:N/A)
WARNING | Crash service did not start
WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
WARNING | cannot add library vulkan-1.dll: failed
WARNING | cannot add library vulkan-1.dll: failed
INFO | added library C:\Users\This pc\AppData\Local\android\emulator\lib64\vulkan\vulkan-1.dll
INFO | configAndStartRenderer: setting vsync to 60 hz
ERROR | Failed to open /qemu.conf, err: 2
Incompatible HAX module version 3,requires minimum version 4
No accelerator found.
C:\Users\This pc\AppData\Local\android\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: failed to initialize HAX: Invalid argument
Try this page: https://developer.android.com/studio/run/emulator-acceleration.
Judging from the line in your error "Incompatible HAX module..." you need an update.
In "Windows Features" I have Hyper-V unchecked, Virtual Machine Platform and Windows Hypervisor Platform checked.
Here's similar output from my machine where I have a working emulator set to x86 and api 30. My problem is getting my app running on api 31+ and 86_64.
INFO | configAndStartRenderer: setting vsync to 60 hz
INFO | added library vulkan-1.dll
ERROR | Failed to open /qemu.conf, err: 2
WHPX on Windows 10.0.22000 detected.
Windows Hypervisor Platform accelerator is operational

ESP32 JTAG Programming fails at Verification

The code is working. I can build it and to mention. it was working, i could upload it to my custom made ESP32 board. From all of a sudden it stopped working. Tried with different PCB boards also different cables.
I somehow resolved my problem so i can program it, but now i get a verification error after Programming Finished
Here is my complete log from terminal.
Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
-----------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.4.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-espidf 3.40301.0 (4.3.1)
- tool-cmake 3.16.4
- tool-esptoolpy 1.30100.210531 (3.1.0)
- tool-mkspiffs 2.230.0 (2.30)
- tool-ninja 1.9.0
- tool-openocd-esp32 2.1000.20210721 (10.0)
- toolchain-esp32ulp 1.22851.191205 (2.28.51)
- toolchain-riscv32-esp 8.4.0+2021r1
- toolchain-xtensa-esp32 8.4.0+2021r1
- toolchain-xtensa-esp32s2 8.4.0+2021r1
Reading CMake configuration...
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Retrieving maximum program size .pio/build/esp32dev/firmware.elf
Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 10.1% (used 32992 bytes from 327680 bytes)
Flash: [======== ] 75.7% (used 794197 bytes from 1048576 bytes)
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esp-prog
Uploading .pio/build/esp32dev/firmware.bin
Open On-Chip Debugger v0.10.0-esp32-20210721 (2021-07-21-13:34)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
adapter speed: 20000 kHz
WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
adapter speed: 2000 kHz
** Programming Started **
** Programming Finished **
** Verify Started **
Error: **** Verification failure! ****
Error: target_hash cbc6a9...992065
Error: file_hash: 773d62...93803f
embedded:startup.tcl:449: Error: ** Verify Failed **
in procedure 'program_esp'
in procedure 'program_error' called at file "/Users/USER/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 135
at file "embedded:startup.tcl", line 449
*** [upload] Error 1

Android Emulator not running on M1

I cannot start the android emulator V30.9.4
I got this error message:
INFO | Android emulator version 30.9.4.0 (build_id 7759208) (CL:N/A)
WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
WARNING | cannot add library /Users/-/Library/Android/sdkPreview/emulator/qemu/darwin-aarch64/lib64/vulkan/libvulkan.dylib: failed
WARNING | cannot add library /Users/-/Library/Android/sdkPreview/emulator/lib64/vulkan/libvulkan.dylib: failed
ERROR | EglOsGlLibrary: Could not open GL library libGLESv2.dylib [dlopen(libGLESv2.dylib, 0x0002): tried: '/Users/-/Library/Android/sdkPreview/emulator/lib64/qt/lib/libGLESv2.dylib' (no such file), '/Users/-/Library/Android/sdkPreview/emulator/lib64/gles_swiftshader/libGLESv2.dylib' (code signature]
ERROR | EglOsEglDispatcher: Could not open EGL library libEGL.dylib [dlopen(libEGL.dylib, 0x0002): tried: '/Users/-/Library/Android/sdkPreview/emulator/lib64/qt/lib/libEGL.dylib' (no such file), '/Users/-/Library/Android/sdkPreview/emulator/lib64/gles_swiftshader/libEGL.dylib' (code signature in <5C3A]
It works with sudo privilege.
Try to use the host system's OpenGL driver:
cd $ANDROID_SDK_ROOT/emulator
./emulator -avd <Pixel_4_API_29> -gpu host
Then go to Emulator Settings -> Settings -> Advanced.
Select OpenGL ES renderer "Autodetect based on host".
Save & restart.
P.S. Get list of avds:
./emulator -list-avds
https://developer.android.com/studio/run/emulator-acceleration#command-gpu

Android emulator failed to start after a successful aosp build

Follow the official build guide.
I downloaded the master branch and built the aosp_arm-eng target. The build process was fine, but when I tried to start the emulator, it failed with the following logs:
.......
emulator: GPU emulation enabled using 'host' mode
emulator: Initializing hardware OpenGLES emulation support
emulator: VERBOSE: MultiDisplay.cpp:312: create display 0
emulator: VERBOSE: MultiDisplay.cpp:401: setDisplayPose 0 x 0 y 0 w 480 h 800 dpi 0
cannot add library /media/kevin/Data/aosp/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
added library /media/kevin/Data/aosp/prebuilts/android-emulator/linux-x86_64/lib64/vulkan/libvulkan.so
cannot add library /media/kevin/Data/aosp/prebuilts/android-emulator/linux-x86_64/lib64/vulkan/libvulkan.so.1: full
emulator: VERBOSE: load_config.cpp:242: Verified boot params were not found.
.......
emulator: Starting QEMU main loop
emulator: Adding boot property: 'ro.opengles.version' = '196609'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'both'
emulator: Adding boot property: 'dalvik.vm.heapsize' = '512m'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '0'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '240'
qemu-system-aarch64: -chardev socket,port=46269,host=localhost,nowait,nodelay,ipv6,id=modem: Failed to connect socket: Connection refused
emulator: Done with QEMU main loop
I had searched around, and tried install some vulkan related packages.
I'd also tried to create an Android Virtual Device by using the built files,the avd just showed an empty black screen. But the AVDs created from the offical images works well on my computer.
System Info:
Ubunutu 20.04
CPU: 14-Core Intel Xeon E5-2680 v4 (-MT MCP-) speed/min/max: 1199/1200/3300 MHz Kernel: 5.4.0-58-generic x86_64 Up: 1d 23h 10m
Graphics: Device-1: Advanced Micro Devices [AMD/ATI] Baffin [Radeon RX 550 640SP / RX 560/560X] driver: amdgpu v: kernel
Display: x11 server: X.Org 1.20.8 driver: amdgpu resolution: 3840x2160~60Hz
OpenGL: renderer: Radeon RX 560 Series (POLARIS11 DRM 3.35.0 5.4.0-58-generic LLVM 10.0.0) v: 4.6 Mesa 20.0.8
Don't use the master branch....this the bleeding edge branch and has many bugs...
Try the released branches.

PlatformIO:[upload] Error 2 with esp8266 ESP-07 board

I use VSCODE to create project. I create a project and select ESp-07 board and ESP8266 RTOS SDK framework then create a main.c file in src directory and copy content of main.c file of esp8266-rtos-sdk-blink example to my project main.c file. it compile successfully but when i want to upload it to my board following error occur :
Processing esp07 (platform: espressif8266; framework: esp8266-rtos-sdk; board: esp07)
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp07.html
PLATFORM: Espressif 8266 2.3.2 > Espressif Generic ESP8266 ESP-07
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: toolchain-xtensa 1.40802.0 (4.8.2), framework-esp8266-rtos-sdk 1.5.0-beta.5, tool-esptool
1.413.0 (4.13), tool-esptoolpy 1.20800.0 (2.8.0), tool-mkspiffs 1.200.0 (2.0)
LDF: Library Dependency Finder -> bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies…
No dependencies
Building in release mode
Retrieving maximum program size .pio\build\esp07\firmware.elf
Checking size .pio\build\esp07\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
DATA: [==== ] 36.3% (used 29754 bytes from 81920 bytes)
PROGRAM: [======= ] 73.9% (used 278664 bytes from 376832 bytes)
Configuring upload protocol…
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port…
Auto-detected: COM3
Uploading .pio\build\esp07\firmware.bin
esptool.py v2.8
Serial port COM3
Connecting…
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:33:a6:e6
Uploading stub…
Running stub…
Stub running…
Configuring flash size…
Auto-detected Flash size: 1MB
A fatal error occurred: File C:\Users\MrTavakoli.platformio\packages\framework-esp8266-rtos-sdk\bin\esp_init_data_default.bin (length 128) at offset 4177920 will not fit in 1048576 bytes of flash. Use --flash-size argument, or change flashing address.
*** [upload] Error 2
I test my board with Arduino framework successfully.
Thanks you
I use esp01-1M board instead of esp07 board and compile then upload to esp07 board successfully.
again change board to esp07 and add
board_upload.maximum_size = 1048576
to platformio.ini file and compile and upload toesp07` board successfully.
I found 1048576 value from esp01_1m.json file.