Could not able to run the MuPDF Project

733 views Asked by At

I am having code of MuPDF Library which i want to use in my application. I tried to import the project and tried to run it.

But the problem is that it run properly and shows the list of PDF files at the starting of an application ,but as i select any pdf file it just gets crashed and throwing me error as below:

11-15 16:48:21.308: E/AndroidRuntime(31013): FATAL EXCEPTION: main
11-15 16:48:21.308: E/AndroidRuntime(31013): Process: com.artifex.mupdfdemo, PID: 31013
11-15 16:48:21.308: E/AndroidRuntime(31013): java.lang.UnsatisfiedLinkError: Couldn't load mupdf from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.artifex.mupdfdemo-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.artifex.mupdfdemo-1, /vendor/lib, /system/lib]]]: findLibrary returned null
11-15 16:48:21.308: E/AndroidRuntime(31013):    at java.lang.Runtime.loadLibrary(Runtime.java:358)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at java.lang.System.loadLibrary(System.java:526)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at com.artifex.mupdfdemo.MuPDFCore.<clinit>(MuPDFCore.java:14)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at com.artifex.mupdfdemo.MuPDFActivity.openFile(MuPDFActivity.java:214)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at com.artifex.mupdfdemo.MuPDFActivity.onCreate(MuPDFActivity.java:320)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.app.Activity.performCreate(Activity.java:5231)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.os.Handler.dispatchMessage(Handler.java:102)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.os.Looper.loop(Looper.java:136)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at android.app.ActivityThread.main(ActivityThread.java:5001)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at java.lang.reflect.Method.invokeNative(Native Method)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at java.lang.reflect.Method.invoke(Method.java:515)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-15 16:48:21.308: E/AndroidRuntime(31013):    at dalvik.system.NativeStart.main(Native Method)

The error shows that an application is not able to get the library which is developed in C/C++ native code. I tried many solutions but still i am not getting any success in this.

Solutions Tried:

export mupdf and android studio 0.5.4

https://code.google.com/p/android/issues/detail?id=66937

Can Anyone guide me to solve this error?

Thank you.

1

There are 1 answers

0
silversunhunter On

I worked on this for a week straight. Android Studio will not compile with NDK. You have to use Eclipse.

Once I finally downloaded Eclipse and set it up it compiled and ran on my device. No trouble at all.

Follow the "build for Android" tutorial on the MuPDF website.

Import the build into Eclipse

Build it and test it on your device

Link it to your project by:

right click on Mupdf package in eclipse -> Properties ->android -> (bottom of window) check Is Library

right click on your package in eclipse -> Properties ->android -> (bottom of window) click Add in the library section. Selet Mupdf package and ok

Clean your project from the project menu then debug/run from the run menu. Test it on your device. Magic!