Could not initialize OpenglES emulation, using software renderer.

I needed to launch one of my Android emulators from the terminal recently and I was surprised to see how slow it was, especially seeing as I had enabled host GPU acceleration and that the emulator an x86 one with HAXM enabled.  I had never experienced any such issues when starting the same emulator from my IDE.  The exact error that I received was this:

emulator: ERROR: Could not load OpenGLES emulation library: dlopen(libOpenglRender.dylib, 1): image not found
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.

I had a suspicion that this library may have been lurking in the SDK somewhere so I had a peek and discovered where it was hiding.

$ find $ANDROID_HOME -name 'libOpenglRender.dylib' 
/Applications/Android Studio.app/sdk/tools/lib/libOpenglRender.dylib

The solution was to append the SDK’s lib path to OS X’s LD_LIBRARY_PATH before invoking the emulator.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANDROID_HOME/tools/lib

Naturally you can put this line in your shell’s startup script and you won’t have to worry about this problem again.

About these ads
This entry was posted in Android, Annoyances, Development and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s