开发者

android JNI loading mupdf (compile with NDK?)

I am creating an Android Xoom application which displays a pdf in one of the Activities.

I have downloaded the mupdf source files: mupdf.c, Android.mk, Application.mk, Core.mk, and ThirdParty.mk.

I have also been to the mupdf.com web site and tried downloading various pre-compiled packages from here: http://ccxvii.net/mupdf/download/

I just switched to Android fr开发者_StackOverflowom the iPhone and have a few things to learn regarding including C code. I put the mk / c files into /jni/ in my project. I have also tried to copy the precompiled files I downloaded from the web site above in /jni/ in my project.

I have a simple class:

import android.graphics.*;

    public class PDFView {  
        static {
            System.loadLibrary("mupdf");
        }
    }

Every time I create an instance of this class the app crashes and it says "ExceptionInInitializerError" as well as "Couldn't load mupdf: findLibrary returned null" in the LogCat.

I have also downloaded the android NDK and tried to compile the source myself. I get a missing mupdf.h error and fitz.h error. Just a whole list of errors and this seems overly complicated to included a library.

I am working on a Mac in Snow Leopard. I think I'm on the right path needing to compile this as a binary, but it's been really frustrating having spent all this time learning about the NDK then it won't compile. Maybe I need an updated source.

Can anyone help point me in the right direction?


You need to setup your include paths properly in your Android.mk

Please post your Android.mk for more help, although in the meantime you can try to borrow from the NDK samples, which are included in your NDK folder.

Try building them as a sanity check first, then look in jni/Android.mk to see how their makefiles are setup.

The docs directory in the NDK also contains great documentation on the Android.mk file.

Honestly, it's going to be hard to use the NDK unless you are experienced in C. Knowing the ins and outs of make, gcc, and ld is of paramount importance.

Edit - to make this process easier, I would clone the mupdf git repository. There is actually an Android project there ready to be built.

Make sure you use git to do the clone, as you want to have all of the necessary files. The readme has simple instructions on building. It seems like getting this working first and tweaking it from there might be a more reliable development path for you.


I have been able to build mupdf library for android. I concur with Paul, I had to do a little bit of tinkering to get it to work. You should be able to fix these errors with minor changes. What you should concentrate on, is making sure the paths to all those different thirdparty source folders are present and correct.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜