Search code examples
androidandroid-studioandroid-emulator

Android Studio loses connection to emulator


Recently I had problems with Android Studio and Emulator on my setup. I updated Windows and Nvidia drivers to latest versions and I was lucky to make it partially "work" again. I still have problem with Android Emulator bundled with Android Studio.

Problem

I have problem with emulator crashing when I control it with long presses. For example:

  • dragging items
  • scrolling
  • rotating camera

In those cases Android Studio "closes" emulator and displays "No Running Emulators". I don't think that emulator itself has crashed because I can see logs in Logcat for few seconds after I lose it from emulator window but after few moments emulator is disconnected.

Sometimes after this problem occurs I can not drag/swipe in emulator but click only. If I am not dragging/swiping emulator seems to be running stable

Here are some logs. Problem occurred at 2022-02-18 15:48:28,863:

2022-02-18 15:38:56,436 [ 310476]   INFO - manager.EmulatorProcessHandler - Emulator: C:\Users\Nonko\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: icmpv6 ICMP6_ECHO_REQUEST failed 
2022-02-18 15:40:15,045 [ 389085]   WARN - com.intellij.util.xmlb.Binding - no accessors for com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginAdvertiserExtensionsStateService$State 
2022-02-18 15:40:15,045 [ 389085]   WARN - com.intellij.util.xmlb.Binding - no accessors for com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginAdvertiserExtensionsStateService$State 
2022-02-18 15:48:07,459 [ 861499]   INFO - manager.EmulatorProcessHandler - Emulator: WARNING | getAttribLocation: Program attrib 'in_uv' not found 
2022-02-18 15:48:07,461 [ 861501]   INFO - manager.EmulatorProcessHandler - Emulator: WARNING | getAttribLocation: Program attrib 'in_uv' not found 
2022-02-18 15:48:19,278 [ 873318]   INFO - rationStore.ComponentStoreImpl - Saving Project(name=yForce, containerState=COMPONENT_CREATED, componentStore=C:\Users\Nonko\Documents\Sources\yForce-android)Kotlin2JvmCompilerArguments took 23 ms 
2022-02-18 15:48:28,863 [ 882903]   WARN - ea.emulator.EmulatorController - android.emulation.control.EmulatorController/streamNotification call failed - UNAVAILABLE: Endpoint read failed 
2022-02-18 15:48:28,863 [ 882903]   WARN - ea.emulator.EmulatorController - android.emulation.control.EmulatorController/streamClipboard call failed - UNAVAILABLE: Endpoint read failed 
2022-02-18 15:48:28,863 [ 882903]   WARN - ea.emulator.EmulatorController - android.emulation.control.EmulatorController/streamScreenshot call failed - UNAVAILABLE: Endpoint read failed 
2022-02-18 15:48:28,863 [ 882903]   INFO - ea.emulator.EmulatorController - Disconnected from Pixel 2 API 30 (5554) 
2022-02-18 15:49:30,541 [ 944581]   INFO - manager.EmulatorProcessHandler - Emulator: INFO    | Shutting down gRPC endpoint 
2022-02-18 15:49:30,541 [ 944581]   INFO - manager.EmulatorProcessHandler - Emulator: INFO    | Shutting down gRPC endpoint 
2022-02-18 15:49:31,091 [ 945131]   INFO - b.PhysicalDeviceChangeListener - emulator-5554 state changed to OFFLINE 
2022-02-18 15:49:31,092 [ 945132]   WARN -            #com.android.ddmlib - Failed to start monitoring emulator-5554 
2022-02-18 15:49:31,140 [ 945180]   INFO - manager.EmulatorProcessHandler - Emulator: INFO    | Android emulator version 31.2.8.0 (build_id 8143646) (CL:N/A) 
2022-02-18 15:49:31,140 [ 945180]   INFO - manager.EmulatorProcessHandler - Emulator: Process finished with exit code 0 
2022-02-18 15:49:31,354 [ 945394]   INFO - id.tools.idea.ddms.DevicePanel - Device disconnected: emulator-5554 
2022-02-18 15:49:31,354 [ 945394]   INFO - b.PhysicalDeviceChangeListener - emulator-5554 disconnected 

Crash example

Specs

  • i7-9750h
  • 16gb ram
  • RTX 2060 with 511.79 drivers
  • Windows 11 Enterprise 21H2 22000.527 Windows Feature Experience Pack 1000.22000.527.0
  • Android Studio 2021.1.1.1 Patch 1
  • Emulator 31.2.8
  • Platform tools 32
  • Tried multiple images - none of them worked

Solution

  • I managed to get around this issue by turning OFF the setting "Launch in a tool window" found under Settings->Tools->Emulator. The emulator launches in a separate window but you can scroll.