8

I have tried installing kvm from this link: https://help.ubuntu.com/community/KVM/Installation

But even after trying this the emulator is slow when running in Software GLES 2.0 mode and when I select Hardware GLES 2.0 as Graphics I am not able to launch the avd. It shows starting avd for a few seconds and then nothing happens after that. Is there something I am missing here ?

3
  • Leave Hardware GLES 2.0 selected, run this from console /yoursdkpath/emulator/.emulator -avd youremulatorname -use-system-libs and tell me what happens. Be careful replacing your exact sdk path and emulator name. Apr 24, 2017 at 18:16
  • @MartinRevert Thank you! It works perfectly. So I have to launch it through the terminal all the time ? Apr 25, 2017 at 8:23
  • No you don't. I was only trying to diagnose the problem. I will post an answer with the solution in a few minutes. Apr 25, 2017 at 8:43

1 Answer 1

16

So, the problem is that Android SDK cannot find the OpenGL config and libs. Google distributes OpenGL libraries with the SDK but in Ubuntu that config is broken because C++ library could't be found, so the best solution that I found is to point a simbolic link to the system libraries that you already have on Ubuntu. The previous test that I made you to execute forces that situation from command line, but with the next steps you can have a more permanent and confortable solution, allowing you to fire any Hardware Accelerated emulator directly from AVD UI.

First of all, your system libs are on this Ubuntu path:

/usr/lib/x86_64-linux-gnu/

If there's no libstdc++.so.6file present inside /usr/lib/x86_64-linux-gnu/ , please install it with:

sudo apt install libstdc++6

In your situation is pretty obvious that you already have the correct libs installed or the emulators will not start neither from command line, but I leave the previous step for people who don't have the correct lib installed on their systems.

So, now we need to tell the Android SDK that we need to use the system libs. For that just do the following:

If there is a libstdc++6 file inside ~/yoursdkpath/emulator/lib64/libstdc++/ do mv libstdc++6 libstdc++6.bak to backup it.

Then:

ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6  ~/yoursdkpath/emulator/lib64/libstdc++/libstdc++.so.6

And that's it, go to AVD and start any emulator with Hardware GLES 2.0 config selected and it will work.

IMPORTANT: From time to time Google will update your emulators. If for some reason you notice that after a Google update the emulators stop launching from AVD, repeat this steps and all will return to normal.

2
  • 1
    I cannot find libstdc++ directory in SDK/emulator/lib64 I am using ubuntu 20. Feb 7, 2021 at 10:50
  • You have to create the directory yourself.
    – bemoore
    Apr 2, 2021 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.