Monthly Archives: September 2011

JPEG support for Android: resolving libjpeg.so conflicts

When porting GPAC to Android (2.3 as of today), we’ve been facing a very strange and annoying problem: JPEG images didn’t load, and libjpeg was outputing the following message:

We couldn’t find any relevant help on the Web. Discussions always ended up with no response or even some “you don’t understand what you’re doing”. The thing is we have understood and solved the problem.

First, the GPAC Android package (generated as mentionned in the README.txt file) does contain its own libjpeg.so file. The libjpeg.so file is generated from the extra_libs package. When running the Android Osmo4 player within the Eclipse debugger, the Dalvik console prints the following message:

Don’t trust it.

There is a conflict between your local libraries and the ones provided by Android. Google’s dynamic libraries are always loaded first as of Android 2.3. This is annoying because this affects numerous programs and also other dynamic libraries (such as zlib, libpng, …). We could confirm our hypothesis by changing the error messages printed by our own libjpeg.so: it didn’t match the error message showing in the Dalvik console.

The best solution we found is to rename the dynamic library to a non-usual name. libjpeg.so is now named libjpegdroid.so for the GPAC package.

You can find more info on GPAC running on Android from here or watch the following video:

YouTube Preview Image

Romain Bouqueau, Stephane Thomas