How to build MuPDF for Android

Set up an Android build environment

Download and install the Android SDK. Run the android tool to install the platform tools. Add the tools and platform-tools directories inside the SDK directory to your PATH.

Download and install the Android NDK. Add the NDK directory to your PATH.

Make sure you have both JDK and ANT installed.

You will also need git and a regular development environment (gcc and gnu make).

Prepare the source

Check out a copy of the mupdf source from git:

~/src $ git clone git://git.ghostscript.com/mupdf.git

Check out the third party library submodules:

~/src/mupdf $ git submodule update --init

Populate the generated directory with the necessary files:

~/src/mupdf $ make generate

Build and debug

Change into the platform/android directory and edit the local properties configuration file.

~/src/mupdf $ cd platform/android
~/src/mupdf/platform/android $ cp local.properties.sample local.properties
~/src/mupdf/platform/android $ nano local.properties

Build the native code libraries:

~/src/mupdf/platform/android $ ndk-build

Build the java application:

~/src/mupdf/platform/android $ ant debug

Install the app on the device or emulator:

~/src/mupdf/platform/android $ ant debug install

Copy some files onto the device for the app to read:

~/src/mupdf/platform/android $ adb push .../file.pdf /mnt/sdcard/Download/file.pdf

To see debug messages from the emulator:

~/src/mupdf/platform/android $ adb logcat

Good luck!