加载本机c库时出错使用Android版中的PDF视图

时间:2011-11-10 15:54:07

标签: android native

您好我正在尝试从链接下面运行示例应用程序

https://github.com/pangyre/apv

它使用c库来读取pdf文件

但我面临以下错误

java.lang.UnsatisfiedLinkError: Library pdfview2 not found

请告诉我eclipse中是否有其他设置使用本机库

提前致谢

详细日志如下。

11-10 20:47:45.523: ERROR/AndroidRuntime(406): FATAL EXCEPTION: main
11-10 20:47:45.523: ERROR/AndroidRuntime(406): java.lang.ExceptionInInitializerError

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at cx.hell.android.pdfview.OpenFileActivity.getPDF(OpenFileActivity.java:354)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at cx.hell.android.pdfview.OpenFileActivity.startPDF(OpenFileActivity.java:327)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at cx.hell.android.pdfview.OpenFileActivity.onCreate(OpenFileActivity.java:152)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at android.os.Handler.dispatchMessage(Handler.java:99)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at android.os.Looper.loop(Looper.java:123)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at android.app.ActivityThread.main(ActivityThread.java:4627)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at java.lang.reflect.Method.invokeNative(Native Method)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at java.lang.reflect.Method.invoke(Method.java:521)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at dalvik.system.NativeStart.main(Native Method)

11-10 20:47:45.523: ERROR/AndroidRuntime(406): Caused by: java.lang.UnsatisfiedLinkError: Library pdfview2 not found

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at java.lang.Runtime.loadLibrary(Runtime.java:461)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at java.lang.System.loadLibrary(System.java:557)
11-10 20:47:45.523: ERROR/AndroidRuntime(406):     at cx.hell.android.pdfview.PDF.<clinit>(PDF.java:15)

11-10 20:47:45.523: ERROR/AndroidRuntime(406):     ... 16 more

4 个答案:

答案 0 :(得分:2)

https://www.alljoyn.org/forums/developers/unsatisfied-link-error-android-221-device-emulator#comment-745

请点击链接并按照以下步骤操作。

之前我有相同的错误。现在我得到了输出。这在Android原生编译器中存在问题。

答案 1 :(得分:2)

** apv0.3dev13.tar.xz pdf查看器源代码问题:

本机代码库coulndt无法加载:**

Thread [<3> main] (Suspended (exception UnsatisfiedLinkError))  
    Runtime.loadLibrary(String, ClassLoader) line: 489  
    System.loadLibrary(String) line: 557    
    PDF.<clinit>() line: 15 
    OpenFileActivity.getPDF() line: 442 
    OpenFileActivity.startPDF(SharedPreferences) line: 403  
    OpenFileActivity.onCreate(Bundle) line: 169 
    Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1047   
    ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2459  
    ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2512   
    ActivityThread.access$2200(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 119 
    ActivityThread$H.handleMessage(Message) line: 1863  
    ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
    Looper.loop() line: 123 
    ActivityThread.main(String[]) line: 4363    
    Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
    Method.invoke(Object, Object...) line: 521  
    ZygoteInit$MethodAndArgsCaller.run() line: 860  
    ZygoteInit.main(String[]) line: 618 
    NativeStart.main(String[]) line: not available [native method]  


Please use the link. i got the output..
https://www.alljoyn.org/forums/developers/unsatisfied-link-error-android-221-device-emulator#comment-745

答案 2 :(得分:0)

我在Android应用中使用了相同的库。我得到了同样的错误。 据我记得的错误是我在Java代码中重命名了包。我还必须重命名C代码中的本机方法以匹配新包。

您是否重命名了包裹?

答案 3 :(得分:0)

打开终端/命令提示符。导航到Android项目的根目录。运行ndk-build。 有关详细信息,请访问http://developer.android.com/tools/sdk/ndk/index.html