in Android, Linux

Fix: Android emulators not starting in Ubuntu

Often this happens when for some reason or the other your OpenGL config is broken. This is often an issue on Ubuntu 17.04.

To confirm this is your problem, (Assuming your Android SDK lives in ~/Android/Sdk)

Step 1
Get your emulator’s name:
~/Android/Sdk/emulator/emulator -list-avds

In my case it was Nexus_4_API_25

Step 2
Test running using system OpenGL
~/Android/Sdk/emulator/emulator -avd Nexus_4_API_25 -use-system-libs

If the emulator starts successfully we can make this solution semi-permanent by having a symbolic link in the android Sdk dirs to the system’s openGL

Step 3
cd ~/Android/Sdk/emulator/lib64/libstdc++/
mkdir backup
mv libstdc++.so.6 backup/
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 .

VoilĂ , you should now be able to launch your emulator from android studio or anywhere else. In the case of any future updates, you can just run the above commands again.

 

Source: Martin Revert (stackoverflow)

Write a Comment

Comment