Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android emulator - unable to load driver

Running on Ubuntu, I'm getting this error:

Cannot launch AVD in emulator.
Output:
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:  GLXBadContext
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  55
  Current serial number in output stream:  54

Platform-tools is the latest.

Emulator image uses https://dl.google.com/android/repository/sys-img/google_apis/x86_64-24_r08.zip and it's on Android N.

Update (Dec 2, 2016): @Sébastien's solution no longer works but gives:

Cannot launch AVD in emulator.
Output:
failed to create drawable
getGLES2ExtensionString: Could not create GLES 2.x Pbuffer!
Failed to obtain GLES 2.x extensions string!
Could not initialize emulated framebuffer
emulator: Listening for console connections on port: 5554
emulator: Serial number of this emulator (for ADB): emulator-5554
emulator: ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.
emulator: WARNING: ./android/metrics/metrics_reporter.cpp:142: Failed to get a writable, unused path for metrics. Tried: /home/me/.android/avd/metrics/metrics.17386.yogibear

If I disable GPU based rendering and switch to software based GL graphics, there is this runtime error:

Firebase API initialization failure.
               DeadSystemException: The system died; earlier logs will point to the root cause
FATAL EXCEPTION: main
                  Process: com.whatever.mobile, PID: 4501
                  DeadSystemException: The system died; earlier logs will point to the root cause
like image 870
Gabor Avatar asked Oct 16 '16 01:10

Gabor


3 Answers

Had the same issue and my fix was to set the following env variable:

export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

In my case I put it in ~/.bashrc. With that being sent I start emulator as usual, i.e. from command line:

$ emulator -avd Nexus_4_API_23

Looks like it's a common well-known problem tracked in Android bug tracker: https://code.google.com/p/android/issues/detail?id=197254

like image 149
pelotasplus Avatar answered Oct 31 '22 22:10

pelotasplus


I've just face the same error, and simply deleting $ANDROID_HOME/tools/lib64/libstdc++/* worked for me. libstdc++ version shipped with 16.10 (6.0.22) is greater than the one shipped with the sdk tools (6.0.18), and I suppose it creates conflicts with other libraries.

like image 35
Sébastien Avatar answered Oct 31 '22 23:10

Sébastien


The issue is related to libstdc++.so.6 go to Android SDK and can be resolved with the following command:

cd ~/...../sdk/tools/lib64/libstdc++
mv libstdc++.so.6 libstdc++.so.6_OLD
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6

Credit: https://code.google.com/p/android/issues/detail?id=197254#c43

like image 28
Basi Avatar answered Oct 31 '22 22:10

Basi