Difference: BuildingAndroidMuPDFMobile (1 vs. 2)

Revision 22016-12-21 - FredRossPerry

Line: 1 to 1

Building the Android example

Revision 12016-12-21 - FredRossPerry

Line: 1 to 1

Building the Android example

First do these steps, as you would do with any muPDF project:

get the latest code
git submodule update --init
make generate

Install Android Studio if you haven't already.

Install the latest Android SDK and NDK.

Obtain a copy of libgs.so, and place it in mupdf/platform/android/viewer/jni
setting FZ_ENABLE_GPRF (below) enables use of this library

Now build the old viewer, which produces libmupdf_java32.so. This library actually
contains both the old and new versions of the JNI interface.

cd mupdf/platform/android/viewer
ndk-build clean
ndk-build FZ_ENABLE_GPRF=1

Copy the resulting file to the new example app:

mkdir -p ../example/mupdf/libs/armeabi-v7a
rm -f ../example/mupdf/libs/armeabi-v7a/libmupdf_java32.so
cp ./libs/armeabi-v7a/libmupdf_java32.so ../example/mupdf/libs/armeabi-v7a/

Also put a copy of libgs.so in mupdf/platform/android/example/mupdf/libs/armeabi-v7a/

Open the example project in Android Studio.
The first time you'll get a message about syncing the Gradle files, say OK to all of that.

If you see a message about "unregistered VCS root detected", choose Add Root. This will allow you to use git from inside AS.

Edit local.properties to point to the place where you've got the sdk and ndk installed.
For example, the stadard locations in OSX are


At this point you can build the example in Android Studio. It may take a while and you might get asked
about installing additional tools and SDKs along the way.

-- Fred Ross-Perry - 2016-12-21


This site is powered by the TWiki collaboration platform Powered by PerlCopyright 2014 Artifex Software Inc