简体   繁体   English

加载armabi库或加载.so文件

[英]load armabi library or load .so files

I want to use the Android-pdfview library to show a pdf file within my application. 我想使用Android-pdfview库在我的应用程序中显示pdf文件。 I already compiled the library sucessfully, but when I want to Display the pdf following logcat Errors appear: 我已经成功编译了库,但是当我想在logcat之后显示pdf时出现错误:

 java.lang.UnsatisfiedLinkError: Couldn't load vudroid from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/de.gestureanywhere-1.apk"],nativeLibraryDirectories=[/data/app-lib/de.gestureanywhere-1, /vendor/lib, /system/lib]]]: findLibrary returned null
        at java.lang.Runtime.loadLibrary(Runtime.java:358)
        at java.lang.System.loadLibrary(System.java:526)
        at de.gestureanywhere.Changelog_View.onCreate(Changelog_View.java:60)
        at android.app.Activity.performCreate(Activity.java:5241)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2151)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236)
        at android.app.ActivityThread.access$800(ActivityThread.java:138)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5034)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
        at dalvik.system.NativeStart.main(Native Method)

I have read a couple of hours and found out, that I have to compile the libvudroid.so or have to compile the armeabi library. 我已经阅读了几个小时,才发现我必须编译libvudroid.so或必须编译armeabi库。

But all the how to, which I have read before, won't work. 但是,我之前阅读过的所有操作方法都行不通。

So can you provide me please a step by step solution how to compile the library? 那么您能否为我提供一个逐步解决方案如何编译库?

My gradle file Looks like this right now: 我的gradle文件现在看起来像这样:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"
    compileOptions.encoding = 'ISO-8859-1'

defaultConfig {
    applicationId "de.gestureanywhere"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile ( 'proguard-android.txt' ), 'proguard-rules.pro'
    }
}
}
dependencies {
    compile fileTree ( include: '*.jar', dir: 'libs' )
    compile 'com.android.support:appcompat-v7:22.0.0'
compile files ( 'libs/android-pdfview-1.0.3.jar' )

}

Thanks a lot for helping. 非常感谢您的帮助。

The jar file does not contain the native libraries required for the pdfview library to work. jar文件不包含pdfview库运行所需的本机库。

Instead of 代替

compile files ( 'libs/android-pdfview-1.0.3.jar' )

use 采用

compile 'com.joanzapata.pdfview:android-pdfview:1.0.4@aar'

to load the AAR package dependency which contains the java and native library. 加载包含Java和本机库的AAR包依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM