Android AVDs not working with hardware acceleration

拈花ヽ惹草 提交于 2020-01-07 05:34:08

问题


4.9.0-2-amd64 #1 SMP Debian 4.9.18-1 (2017-03-30) x86_64 GNU/Linux
Android Studio 2.3.3

When I try to run an AVD with hardware acceleration I get this error:

emulator -avd n5 -verbose
...
emulator: Initializing hardware OpenGLES emulation support
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  155 (GLX)
...

So then I tried to use my system libraries ( running with -use-system-libs) and it started but the display small but it does accept input:

EDIT: Ok the the input is borked still but I think I know why the screen is so small, I have a high density display. Perhaps there is a way to compensate for this?

EDIT2: It does accept input (there was just some lag). So the problem is just the small screen. Ive tried a variety of AVD images but all have the same issue.


回答1:


I'm using a 15" 4k display, so disabling scaling globally was not an option for me. Instead I was looking to disable scaling for the avd only.

Unfortunately I was unable to add QT_SCREEN_SCALE_FACTORS=1 as a parameter before the emulator command in android studio settings.

What I ended up doing was renaming {$ANDROID_SDK}/emulator/emulator binary and placing a script like this:

#!/bin/bash
QT_SCREEN_SCALE_FACTORS=1 {FULL_path_to_sdk_here}/emulator/emulator.trick "$@"

This worked great for me, and I have not noticed any drawback. To my surprise the emulator didn't show up really tiny, instead it now fills the whole size of the original window!




回答2:


This was an issue with screen scaling.

I use KDE plasma with a screen scalling setting of 1.5 which caused this issue.



来源:https://stackoverflow.com/questions/44118971/android-avds-not-working-with-hardware-acceleration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!