How to Build MuPDF-Android

How to 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 (r6 or later). Use the 32-bit target NDK if targeting a 32-bit platform! 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/viewer directory and edit the local properties configuration file.
~/src/mupdf $ cd platform/android/viewer
~/src/mupdf/platform/android/viewer $ cp local.properties.sample local.properties
~/src/mupdf/platform/android/viewer $ nano local.properties

Build the native code libraries:
~/src/mupdf/platform/android/viewer $ ndk-build

Build the java application:
~/src/mupdf/platform/android/viewer $ ant debug

Install the app on the device or emulator:
~/src/mupdf/platform/android/viewer $ ant debug install

Copy some files onto the device for the app to read:
~/src/mupdf/platform/android/viewer $ adb push …/file.pdf /mnt/sdcard/Download/file.pdf

To see debug messages from the emulator: ~/src/mupdf/platform/android/viewer $ adb logcat