0

I am working on APV pdf reader. I am facing System.loadLibrary("pdfview2"); error. It's giving java.lang.UnsatisfiedLinkerror.
How to fix this issue? I installed Android-NDK also, but not getting how to load native libraries. Full confusion. Please suggest me a way to fix this issue.

09-26 12:51:44.243: E/AndroidRuntime(2537): FATAL EXCEPTION: main
09-26 12:51:44.243: E/AndroidRuntime(2537): java.lang.ExceptionInInitializerError
09-26 12:51:44.243: E/AndroidRuntime(2537):     at cx.hell.android.pdfview.OpenFileActivity.getPDF(OpenFileActivity.java:541)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at cx.hell.android.pdfview.OpenFileActivity.startPDF(OpenFileActivity.java:502)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at cx.hell.android.pdfview.OpenFileActivity.onCreate(OpenFileActivity.java:219)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at android.os.Looper.loop(Looper.java:123)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at android.app.ActivityThread.main(ActivityThread.java:3683)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at java.lang.reflect.Method.invokeNative(Native Method)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at java.lang.reflect.Method.invoke(Method.java:507)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at dalvik.system.NativeStart.main(Native Method)
09-26 12:51:44.243: E/AndroidRuntime(2537): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load pdfview2: findLibrary returned null
09-26 12:51:44.243: E/AndroidRuntime(2537):     at java.lang.Runtime.loadLibrary(Runtime.java:429)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at java.lang.System.loadLibrary(System.java:554)
09-26 12:51:44.243: E/AndroidRuntime(2537):     at cx.hell.android.lib.pdf.PDF.<clinit>(PDF.java:25)
09-26 12:51:44.243: E/AndroidRuntime(2537):     ... 16 more

Hi i attached the log report .its giving :- Caused by: java.lang.UnsatisfiedLinkError: Couldn't load pdfview2: findLibrary returned null

Nermeen
  • 15,883
  • 5
  • 59
  • 72
  • it can be for a lot of reasons, check http://stackoverflow.com/questions/3262440/how-to-resolve-the-java-lang-unsatisfiedlinkerror-in-ndk-in-android http://stackoverflow.com/questions/10862208/android-ndk-java-lang-unsatisfiedlinkerror http://stackoverflow.com/questions/5626967/beginner-help-with-ndk-java-lang-unsatisfiedlinkerror – Nermeen Sep 26 '12 at 07:08
  • hi.. here i am not getting how to and where to start modifying the APV reader. can you please suggest if you having any idea. – balu_itsMyNest Sep 26 '12 at 07:16
  • can you post your log, to try to specify the error.. – Nermeen Sep 26 '12 at 07:20
  • hi i added the log report. please check – balu_itsMyNest Sep 26 '12 at 07:28

4 Answers4

3

After building your project, look in the libs/ folder for the resulting .so. If you're building for ARM, is there an armeabi or armeabi-v7a folder with your .so in it? You can set the architectures you want to support in jni/Application.mk with the APP_ABI variable.

APP_ABI := armeabi armeabi-v7a x86 mips

will build your library for all of the possible supported architectures.

Don't forget that Android's dynamic linker is dumb and won't load library dependencies automatically. If you're using C++ code with gnustl_shared, for example, you'll need to load that before any libraries that are linked against it.

static {
    System.loadLibrary("gnustl_shared");
    System.loadLibrary("a_cplusplus_library");
}
LightStruk
  • 1,451
  • 14
  • 17
  • Thanks for your supporting answer... here i am using APV PDF Reader. i didnt get proper documentaion also and first time i am using ndk. any detail procedure is there to,how to build project.? can you help me for this please... – balu_itsMyNest Sep 27 '12 at 07:09
  • +1 I wish I could give you a +10 because I've wasted an entire day trying to solve this problem and the solution was so simple: in jni/Application.mk add the line `APP_ABI := armeabi armeabi-v7a x86 mips`. It was only generating armeabi/liblibname.so, now it creates a folder for each architecture. – 2013Asker Mar 08 '14 at 00:38
0

Make sure that you have libpdfview2.so in your libs folder..

http://code.google.com/p/apv/issues/detail?id=42
Android - 'Couldn't load Foo: findLibrary returned null'

Community
  • 1
  • 1
Nermeen
  • 15,883
  • 5
  • 59
  • 72
0

Another reason for this failure, in my experience, is the presence of libs/armeabi and not libs/armeabi-v7a. Copy the contents of libs/armeabi into a new folder named libs/armeabi-v7a.

tricknology
  • 1,092
  • 1
  • 15
  • 27
0

1- make sure name of native function Java_package_className_methodName

2- APP_ABI := all64 //defined in jni/Application.mk

Error
  • 820
  • 1
  • 11
  • 34