Vitamio样本误差 - java.lang.UnsatisfiedLinkError中:无法加载VINIT findLibrary返回null [英] Vitamio Sample Error - java.lang.UnsatisfiedLinkError: Couldn't load vinit findLibrary returned null

查看:660
本文介绍了Vitamio样本误差 - java.lang.UnsatisfiedLinkError中:无法加载VINIT findLibrary返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有从 https://github.com/yixia/VitamioBundle

我与Android Studio生成它,它编译罚款和运行,但是当它到达这一行:

I am building it with Android Studio and it compiles fine and runs, but when it gets to this line:

if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))
    return;

它抛出,当我在我的Nexus 5运行异常(也是在银河S4):

It throws an exception when I run it on my Nexus 5 (and also on a Galaxy S4):

01-22 11:58:40.759  12323-12323/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: io.vov.vitamio.demo, PID: 12323
java.lang.UnsatisfiedLinkError: Couldn't load vinit from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/io.vov.vitamio.demo-1.apk"],nativeLibraryDirectories=[/data/app-lib/io.vov.vitamio.demo-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 io.vov.vitamio.Vitamio.<clinit>(Vitamio.java:258)
        at io.vov.vitamio.LibsChecker.checkVitamioLibs(LibsChecker.java:40)
        at io.vov.vitamio.demo.VitamioListActivity.onCreate(VitamioListActivity.java:40)
        at android.app.Activity.performCreate(Activity.java:5231)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        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:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)

唯一的例外,当我跑在我自己的应用程序的V4.2.0树也会发生。

The exception also happens when I'm running the v4.2.0 tree in my own app.

任何想法,我缺少的是什么?在我自己的应用程序,我拉着vitamio项目进入了库文件夹和我引用它是这样的:

Any idea what I'm missing? In my own app I pulled the vitamio project into a libraries folder and am referencing it like this:

     compile(project(':libraries:vitamio'))

示例项目保持原样。

The sample project is left as-is.

推荐答案

我不知道是否有在维生素护(或gradle这个)的新版本更清洁的方式。但这里是我得到了它的gradle与构建工具0.6工作。

I am not sure if there is a cleaner way in the newer version of Vitamino (or gradle). But here is how I got it to work with gradle build tools 0.6.


  1. 增加了一个项目,我的/库,与维生素护源/ SDK目录。这有一个/库/ armeabi /库/ armeabi-V7A与libvinit.so内。

  1. Added a project to my /libraries directory with the vitamino source/sdk. This has a /libs/armeabi /libs/armeabi-v7a with libvinit.so inside.

在我的build.gradle我的主要项目,引用库项目,如:

In my build.gradle for my main project, reference the library project like:

dependencies {

    // other dependencies 

    compile(project(':libraries:vitamio'))

}


  • 下面添加到我的build.gradle底部

  • Add the following to the bottom of my build.gradle

    task copyNativeLibs(type: Copy) {
        from(new File(project(':libraries:vitamio').getProjectDir(), 'libs')) { include '**/*.so' }
    into new File(buildDir, 'native-libs')
    }
    
    tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn copyNativeLibs }
    
    clean.dependsOn 'cleanCopyNativeLibs'
    
    tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
        pkgTask.jniDir new File(buildDir, 'native-libs')
    }
    


  • 然后当我运行一个干净,重建将本机库复制到适当位置,包括他们在构建。

    Then when i run a clean and rebuild it will copy the native libs to the proper spot and include them in the build.

    这篇关于Vitamio样本误差 - java.lang.UnsatisfiedLinkError中:无法加载VINIT findLibrary返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆