无法加载本机文件



我正在尝试运行一个在此处找到的车道检测代码:https://github.com/wahibhaq/android-opencv-lanedetection

我在三星Galaxy选项卡上运行这个应用程序,该应用程序显示我设置hough值的初始屏幕,但当我继续时,它崩溃了。logcat显示以下内容:

12-11 22:09:18.926  31825-31825/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: tum.andrive.lanedetection, PID: 31825
java.lang.UnsatisfiedLinkError: Couldn't load LaneDetectionNative from     loader dalvik.system.PathClassLoader[dexPath=/data/app/tum.andrive.lanedetection-5.apk,libraryPath=/data/app-lib/tum.andrive.lanedetection-5]: findLibrary returned null
        at java.lang.Runtime.loadLibrary(Runtime.java:358)
        at java.lang.System.loadLibrary(System.java:526)
        at tum.andrive.lanedetection.LaneDetector$1.onManagerConnected(LaneDetector.java:53)
        at org.opencv.android.AsyncServiceHelper$3.onServiceConnected(AsyncServiceHelper.java:318)
        at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1119)
        at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1136)
        at android.os.Handler.handleCallback(Handler.java:733)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:157)
        at android.app.ActivityThread.main(ActivityThread.java:5377)
        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:1265)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
        at dalvik.system.NativeStart.main(Native Method)
12-11 22:09:19.246    891-32069/? E/android.os.Debug﹕ !@Dumpstate > sdumpstate -k -t -z -d -o /data/log/dumpstate_app_error
12-11 22:09:22.886  32153-32153/? E/QSEECOMAPI:﹕ Error::Failed to open /dev/qseecom device
12-11 22:09:22.886  32153-32153/? E/QSEECOMAPI:﹕ Error::Failed to open /dev/qseecom device

作为参考,这里是build.gradle。我根据其他类似帖子的建议对其进行了更新:

apply plugin: 'com.android.application'
buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects{
repositories {
    mavenCentral()
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project('openCVLibrary2411')
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }
    // Move the tests to tests/java, tests/res, etc...
    instrumentTest.setRoot('tests')
    // Move the build types to build-types/<type>
    // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
    // This moves them out of them default location under src/<type>/... which would
    // conflict with src/ being used by the main source set.
    // Adding new build types or product flavors should be accompanied
    // by a similar customization.
    debug.setRoot('build-types/debug/java')
    release.setRoot('build-types/release')
}
}

我在build.gradle中的sourceSets部分中使用以下方法解决了这个问题:

jniLibs.srcDirs = ['libs']

相关内容

最新更新