Ubuntu – How to run Android Studio emulator without libGL errors

18.04android-emulatorandroid-studio

I have installed the android-studio snap package from the Snap Store in Ubuntu 18.04. Android Studio Emulator fails with the following errors:

7:17 PM Executing tasks: [:app:assembleDebug]
7:17 PM Emulator: libGL error: unable to load driver: i965_dri.so
7:17 PM Emulator: libGL error: driver pointer missing
7:17 PM Emulator: libGL error: failed to load driver: i965
7:17 PM Emulator: libGL error: unable to load driver: i965_dri.so
7:17 PM Emulator: libGL error: driver pointer missing
7:17 PM Emulator: libGL error: failed to load driver: i965
7:17 PM Emulator: libGL error: unable to load driver: swrast_dri.so
7:17 PM Emulator: libGL error: failed to load driver: swrast
7:17 PM Emulator: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
7:17 PM Gradle build finished in 542ms

enter image description here
(Click image to enlarge)

Best Answer

Here is how I resolved it:

  1. Go to Libstdc++ dir in Android SDK directory

    SDK setting

    cd AndroidSdkDirectory/studio/emulator/lib64/libstdc++
    
  2. Create a back up of libstdc++.so.6:

    mv libstdc++.so.6 libstdc++.so.6.bak
    
  3. Create symbolic link to library:

    ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
    
Related Question