title: Import MuPDF to Android app
body: <p>I am new to Android development, and I want to implement MuPDF in my Android app (.pdf file is on sdcard).
  I downloaded MuPDF source code from here: <a href="http://mupdf.googlecode.com/files/mupdf-1.3-source.tar.gz" rel="nofollow">http://mupdf.googlecode.com/files/mupdf-1.3-source.tar.gz</a>
  I was compile code with 'ndk-build', import to Eclipse, and build apk. Testing on Samsung Galaxy SIII Mini, and application fully working (open content of my sdcard with built-in file manager, and opening and rendering .pdf file succesly).</p>
  
  <p>Than, I was copy-paste sources, resources, libs, jni etc in my own project in Eclipse with no errors (there is no red marks in Eclipse). Build apk, and install apk on SGSIIIMini again. My app and functions of my app, work properly. When I click a button to start 'ChoosePDFActivity.java' (this is now from MuPDF), also working properly, and show me content of my sdcard. But, when I want to open any .pdf file from sdcard (that is a MuPDFActivity.java), I got a Force Close.</p>
  
  <p>This is my logcat:</p>
  
  <pre><code>    IN (Dev1, Dev2, Dev3, Dev4, Dev5, Dev6))ORDER BY rowid LIMIT 1
      I/System.out( 8208): Trying to open /storage/emulated/0/narudzbenica.pdf
   D/dalvikvm( 8208): Trying to load lib /data/app-lib/stiw47.logos.muzicko1-2/libmupdf.so 0x41c49558
  D/dalvikvm( 8208): Added shared lib /data/app-lib/stiw47.logos.muzicko1-2/libmupdf.so 0x41c49558
  D/dalvikvm( 8208): No JNI_OnLoad found in /data/app-lib/stiw47.logos.muzicko1-2/libmupdf.so 0x41c49558, skipping init
  W/dalvikvm( 8208): No implementation found for native Lstiw47/logos/muzicko1/MuPDFCore;.openFile:(Ljava/lang/String;)J
  D/AndroidRuntime( 8208): Shutting down VM
  W/dalvikvm( 8208): threadid=1: thread exiting with uncaught exception (group=0x4199cce0)
  E/AndroidRuntime( 8208): FATAL EXCEPTION: main
  E/AndroidRuntime( 8208): Process: stiw47.logos.muzicko1, PID: 8208
  E/AndroidRuntime( 8208): java.lang.UnsatisfiedLinkError: Native method not found: stiw47.logos.muzicko1.MuPDFCore.openFile:(Ljava/lang/String;)J
  E/AndroidRuntime( 8208):    at stiw47.logos.muzicko1.MuPDFCore.openFile(Native Method)
  E/AndroidRuntime( 8208):    at stiw47.logos.muzicko1.MuPDFCore.&lt;init&gt;(MuPDFCore.java:75)
  E/AndroidRuntime( 8208):    at stiw47.logos.muzicko1.MuPDFActivity.openFile(MuPDFActivity.java:210)
  E/AndroidRuntime( 8208):    at stiw47.logos.muzicko1.MuPDFActivity.onCreate(MuPDFActivity.java:306)
  E/AndroidRuntime( 8208):    at android.app.Activity.performCreate(Activity.java:5231)
  E/AndroidRuntime( 8208):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  E/AndroidRuntime( 8208):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
  E/AndroidRuntime( 8208):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
  E/AndroidRuntime( 8208):    at android.app.ActivityThread.access$800(ActivityThread.java:145)
  E/AndroidRuntime( 8208):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)
  E/AndroidRuntime( 8208):    at android.os.Handler.dispatchMessage(Handler.java:102)
  E/AndroidRuntime( 8208):    at android.os.Looper.loop(Looper.java:136)
  E/AndroidRuntime( 8208):    at android.app.ActivityThread.main(ActivityThread.java:5081)
  E/AndroidRuntime( 8208):    at java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime( 8208):    at java.lang.reflect.Method.invoke(Method.java:515)
  E/AndroidRuntime( 8208):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  E/AndroidRuntime( 8208):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
  E/AndroidRuntime( 8208):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>`
  I would like to provide MuPDFActivity.java code also, but is very, very long, and here is a limit on 30000 characters. </p>
  
  <p>I notice that I declair ChoosePDFActivity.java, MuPDFActivity.java, OutlineActivity.java and PrintDialogActivity.java in AndroidManifest, and, once again, notice that MuPDF app working properly when I compile and build as standalone applications, but I got force close when implement in my app.</p>
  
  <p>Can anyone tell me from logcat, where is my mistake?</p>
  
  <p>EDIT, SOLVED:</p>
  
  <p>I solved my problem. MuPDF is written in native code, and their own java classes won't to run from package with diferent name (I was put all MuPDF's java classes in my package "stiw47.logos.muzicko1"). Just make new package for MuPDF's classes with original name "com.artifex.mupdfdemo", and MuPDF working in my app. :)</p>