AVD Crash on second monitor
Asked Answered
B

7

32

I just installed Android Studio and was trying to get a preview of my application but whenever i start the AVD Emulator on whatever devices or API it crashes, but it only do crash when I swipe the window of the AVD to my second monitor.

my computer configuration : i7-6700k, 16Gb RAM and a GTX 1060
the AVD configuration : AVD Configuration

Anyone had the same problem in the past or have a solution ? feel free to ask me for more info in case I didn't explained enough

Beitz answered 22/6, 2017 at 20:5 Comment(1)
Not sure if this solution applies to you, but I found that if you have gsync enabled it crashes the emulator when moving to a display without gsync enabled.Everywhere
R
111

I had the same problem, and I found a solution that you can have the hardware acceleration still activated and move the AVD between monitors.

Here's how I did it:

  1. Start the AVD.
  2. Go to Extended Controls (the last button on the control strip, with the 3 dots) > Settings > Advanced
  3. Change the "OpenGL ES renderer" to "ANGLE (D3D11)"
  4. Restart the AVD.

And there you go.

Rectory answered 30/8, 2018 at 12:8 Comment(5)
I can confirm that this is still an issue as of September 2020. Going to angle seems to fix the problem. IF any AVD developers read this its always going from primary to secondary display that triggers the issue.Burmaburman
I was wrecking my brain trying to figure out what the issue was and finally this solved my problem.Deibel
I even tried switching it back to automatic after moving it to my secondary window and it would still hang. Had to delete the device and start clean. I'm using a nVidia + Intel UHD cards on a laptop.Renter
Great! That did the trick. I can confirm that this issue is still present on the latest version of Win11 (22H2) with two monitors with different DPI scaling.Champerty
Still a problem in 2023! I switched dev environments and was wondering why it kept crashing. I upvoted this back in 2022 as well. I'm running NVIDIA 3080 and AMD Ryzen 7 5800X.Pow
H
3

I had this same problem and solved it by setting the AVD Graphics performance from 'automatic' or 'hardware' to 'software' graphics acceleration. You can see the setting here: Android AVD graphics acceleration setting picture

You can read more about that setting here: Configure Hardware Acceleration for the Android Emulator

I believe this has something to do with Nvidia drivers and the android emulator, as I only got the problem on the display using a Nvidia GPU and not the display using the Intel integrated one... which is disappointing not to be able to take advantage of the better GPU for graphics acceleration.

Hausa answered 15/5, 2018 at 15:45 Comment(2)
Before settling for the poor performance of software acceleration, try making the desired display be monitor #1. Might also have to place the app that starts the emulator on that same monitor. (Android Studio, Android Device Manager, or Visual Studio.)Cointreau
I actually haven't had this problem since the latest emulator and graphic driver updates. If I encounter it again, I'll try your suggestion.Hausa
S
3

Thanks to the hint provided by Serjux's answer, I resolved my similar problem - Android emulators freeze immediately when moved from one monitor to another. They worked fine without this problem until I upgraded my PC from Intel i5-3570K to AMD Ryzen 7 2700 while the video card GeForce GTX 1050 remained. I use Hyper-V versions of Android emulators. For hw.gpu.mode, I have tried auto, host, angle, mesa, and found only mesa works fine: enter image description here

Sadiron answered 11/12, 2018 at 12:45 Comment(1)
NOTE: Mesa is a software graphics emulator. When using mesa, I recommend doing most testing on devices with fewer pixels. For example, use 720 x 1280, hdpi (240 dpi). That gives you a 6" phone, but with far fewer pixels than current models. Then double those numbers for final testing: 1440 x 2560, xxhdpi (480) or 560 dpi or xxxhdpi (640 dpi).Cointreau
M
2

In my case moving the AVD window very slowly, does the trick.

Serjux's answer works but apparently at the cost of performance. I should mention that moving it to my primary monitor at speed doesn't cause a crash, but moving it quickly to the second one does.

Money answered 22/1, 2020 at 5:35 Comment(0)
T
1

For me what worked was changing the

gpu.mode from config.ini located in users/youruser/.android/avd/emulator-name/config.ini to gpu.mode=host

Tureen answered 29/1, 2022 at 17:32 Comment(1)
No, it isn't working.Haematogenous
O
0

The problem appears also with a i7-6700k, GTX 1080 and miscellaneous AVDs in my environment. It works without a problem when Nvidia Surround is enabled. But this might not be a solution which everyone prefers.

Osmose answered 7/10, 2017 at 21:19 Comment(1)
so we still don't know what causes thoses crashes ?Beitz
D
0

I had the same problem, but the 2018's answer does not helped to me. I found another solution and share here, maybe it can help other peoples.

I just changed the GPU Mode to "Software". In my case it was not possible from the AVD settings, so I did it manually.

In my case the phone is Pixel 4 so the config.ini file is located here: C:\Users\myuser.android\avd\Pixel_4_API_30.avd\config.ini

I replaced hw.gpu.mode = auto by hw.gpu.mode = software

Dey answered 21/2, 2023 at 20:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.