Android Emulator gives an Error SO_REUSEPORT and debugging not working

Viewed 4091

I am getting following error when running emulator, also debugging is not working, it says waiting for debugger to attach. I am wondering if the following has anything to do with getting stuck at "waiting for debugger to attach".

Emulator: E0516 21:01:34.057349753 3279 socket_utils_common_posix.cc:201] check for SO_REUSEPORT: {"created":"@1589644894.057229268","description":"SO_REUSEPORT unavailable on compiling system","file":"/mnt/tmpfs/src/android/emu-master-dev/external/grpc/src/core/lib/iomgr/socket_utils_common_posix.cc","file_line":169}

My android studio version is below.

Android Studio 3.6.3 Build #AI-192.7142.36.36.6392135, built on April 14, 2020 Runtime version: 1.8.0_212-release-1586-b4-5784211 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 5.4.0-29-generic GC: ParNew, ConcurrentMarkSweep Memory: 1246M Cores: 4 Registry: ide.new.welcome.screen.force=true Non-Bundled Plugins:

8 Answers

I had that problem.

I was making a wrong diagnostic.

Running the emulator from Android/Sdk/emulator/emulator with a command such as:

./emulator @Pixel_3_API_28 -netdelay none -netspeed full -debug all also gave me this error, but it is non-blocking.

The problem disappeared when I:

  • switched to proprietary driver (nvidia) in Ubuntu in the Software Updater > Settings > Additional Driver

  • Restarting

  • Recreating my virtual device.

For me the device was working fine until this error started coming up.

Android Studio -> Open AVD Manager -> Select Virtual Device -> Wipe Data fixed the issue for me.

I found a way to lauch emulator after understanding it was a GPU issue...

sudo ubuntu-drivers autoinstall

Changed problem to another :

Blockquote Error while Running Android Application - Could not initialize OpenglES emulation, use '-gpu off' to disable it

So according to this issue and this answer I changed the emulated device for one that allowed me to change 'Software-GLE 2.0' for Graphics,not select 'Automatic' or 'Hardware-GLE 2.0' (emulate graphics in software) (not all of them allow to change it) I used Galaxy Nexus API 30 - R and emulation worked, even I still have this SO_REUSEPORT error ! Hope it can help someone ...

The emulator was showing a android setup notification. Once I clicked on that and setup the phone, the emulator started working for me.

Switching the camera options from Emulated to None fixed it for me.

I had the same issue in Linux, Since I have two graphics card in my laptop, by default I was in powersave mode(Intel). Switching it to Performance mode(Nvidia) solved the issue for me.

The problem seems to be related to the Graphics settings - specifically if you choose Hardware GPU; Either disable the GPU or choose software emulation; Change it from the UI of the emulator, or directly in the config.ini file (in Linux at ~/.android/avd-emulator-name/config.ini):

hw.gpu.enabled=yes
hw.gpu.mode=software
Related