Search code examples
c++pdfandroid-ndkandroid-1.6-donutmupdf

Include .so library to android ndk project


I'm beginning with android NDK. I have to compile a native library for the 1.6 sdk (mupdf) but it requires the ljnigraphics lib (which was added lately on 2.2). I'm trying to include the compiled library to my android project but I can't figure out how to do it. 1. Is it the best way to do this ? 2. If yes how should I proceed ? Any tutorial or information to start will be appreciated. 3. If not do you know any pdf library i could use on android 1.6 ?

Here is my Android.mk file :

    LOCAL_PATH := $(call my-dir)
TOP_LOCAL_PATH := $(LOCAL_PATH)

    MUPDF_ROOT := ..

include $(TOP_LOCAL_PATH)/Core.mk
include $(TOP_LOCAL_PATH)/ThirdParty.mk

include $(CLEAR_VARS)
LOCAL_MODULE    := ljnigraphics 
LOCAL_SRC_FILES := ljnigraphics.so

include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)

LOCAL_C_INCLUDES := \
$(MUPDF_ROOT)/draw \
$(MUPDF_ROOT)/fitz \
$(MUPDF_ROOT)/mupdf
LOCAL_CFLAGS :=
LOCAL_MODULE    := mupdf
LOCAL_SRC_FILES := mupdf.c
LOCAL_STATIC_LIBRARIES := mupdfcore mupdfthirdparty ljnigraphics

LOCAL_LDLIBS    := -lm -llog

include $(BUILD_SHARED_LIBRARY)

EDIT : I succeeded compiling the mupdf library for android 1.6 thanks to the work of Hans-Werner Hilse (http://code.google.com/p/droidreader/).


Solution

  • I finally used the code at http://code.google.com/p/droidreader/