Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android emulator running extremly slow on ubuntu 17.04 compared to windows 10

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 ?

like image 320
Nidhin Rejoice Avatar asked Apr 24 '17 11:04

Nidhin Rejoice


Video Answer


1 Answers

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.

like image 117
Martin Revert Avatar answered Nov 14 '22 23:11

Martin Revert