Android Studio AVD Linux AMDGPU 驱动程序

Android Studio AVD Linux AMDGPU driver

我无法使用最新的开源 AMD 驱动程序 AMDGPU 在 Linux 上通过 AVD(Android 虚拟设备管理器)启动任何虚拟设备。

错误信息:

Cannot launch AVD in emulator.
Output:
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  49
  Current serial number in output stream:  48
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  49
  Current serial number in output stream:  48
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
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:  153 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  33
  Current serial number in output stream:  34
QObject::~QObject: Timers cannot be stopped from another thread

截图形式的错误信息:avd amdgpu error

我认为问题是它需要名为 RadeonSI 的旧开源驱动程序,但我的显卡不再使用它,它使用更新的 AMDGPU。

有什么提示可以解决这个问题吗?

对不起,我错了。这不是 AMDGPU 问题。

以前已知 AVD 捆绑库存在问题。

~/Android/Sdk/tools/emulator -avd Nexus_5_API_23 -use-system-libs

说明

~/Android/Sdk/tools/emulator 是您的 SDK 的路径。您可以在 Android Studio 中找到:文件 -> 设置 -> 外观和行为 -> 系统设置 -> Android SDK

Nexus_5_API_23 是您必须在 Android Studio 中创建的虚拟设备。您可以找到可用设备列表:

~/Android/Sdk/tools/emulator -avd -list-avds

最后: -use-system-libs 使用您的系统库而不是捆绑


以上为临时解决方案。我找到的永久解决方案可能不是那么好。所以使用它需要您自担风险。

在你的主目录.bashrc(隐藏文件)中设置环境变量:

export ANDROID_HOME=/path/to/your/android/sdk

重启/注销。

cd $ANDROID_HOME/tools/lib64/libstdc++
mv libstdc++.so.6 libstdc++.so.6.bak
ln -s /usr/lib64/libstdc++.so.6 $ANDROID_HOME/tools/lib64/libstdc++

显然要确保 $ANDROID_HOME/tools/lib64/libstdc++ 是有效路径。这将取决于您 extract/move 您的 sdk 目录的位置。

在此之后一切都对我有用。

还有一个看起来更合法的解决方案,但遗憾的是对我不起作用。

export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

Issue on Google Bug Tracker