From 6a1f52a68d198df5a054bcb7e8bebc4718e7c975 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 10 Apr 2017 15:56:58 +0200 Subject: Add android library build instructions. --- docs/android-build-library.html | 138 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 docs/android-build-library.html (limited to 'docs') diff --git a/docs/android-build-library.html b/docs/android-build-library.html new file mode 100644 index 00000000..563e5ce3 --- /dev/null +++ b/docs/android-build-library.html @@ -0,0 +1,138 @@ + + + +How to build the MuPDF library for Android + + + + + + +
+

How to build the MuPDF library for Android

+
+ + + +
+ +

+The MuPDF library in Android is based on JNI to access the native C library +through a layer of Java classes. The MuPDF Java library provides platform +independent (i.e. both Android and desktop Java) low level access to MuPDF +functionality. + +

+The MuPDF Java library does not provide any Android specific components +or widgets -- build those yourself or use one of the example viewers as +a start! + +

+In order to use the MuPDF library in Android, you must thus add two components +to your build system: the JNI library, and the Java library. + +

Setting up the MuPDF subproject

+ +

+Set up your Android project as you wish, and then add the mupdf repository +as a directory somewhere in your project. If you're using git, you can +use a submodule: + +

+$ git submodule add git://git.ghostscript.com/mupdf.git libmupdf
+$ cd libmupdf
+$ git submodule update --init
+
+ +

+You can also unpack a release tarball archive in your source directory. + +

+We'll assume you name the mupdf project directory 'libmupdf'. + +

+Use your host compiler to run the 'generate' step in the mupdf project: + +

+$ make -C libmupdf generate
+
+ +

Adding the JNI library

+ +

+Add an NDK-build step to your project, using the Android.mk file from mupdf. + +

+If compiling manually, set the appropriate variables yourself: + +

+$ ndk-build \
+	APP_BUILD_SCRIPT=libmupdf/platform/java/Android.mk \
+	APP_PROJECT_PATH=. \
+	APP_PLATFORM=android-16 \
+	APP_OPTIM=debug \
+	APP_ABI=x86
+
+ +

+If using gradle, add an externalNativeBuild section in the android section +in the build.gradle file: + +

+android {
+	externalNativeBuild {
+		ndkBuild {
+			path 'libmupdf/platform/java/Android.mk'
+		}
+	}
+}
+
+ +

Adding the Java library

+ +

+You'll also need to include the Java classes that bind to the JNI library. + +

+If you're using ant, add the 'libmupdf/platform/java/src' directory +to the list of source directories. For example, set the variables in +an ant.properties file: + +

+source.dir=src;libmupdf/platform/java/src
+java.source=1.7
+java.target=1.7
+
+ +

+If using gradle, add the 'libmupdf/platform/java/src' directory +to the list of source directories in the build.gradle file: + +

+android {
+	sourceSets {
+		main {
+			java {
+				srcDirs = [ "src/main/java", "libmupdf/platform/java/src" ]
+			}
+		}
+	}
+}
+
+ +
+ + + + + -- cgit v1.2.3