简体   繁体   English

Android java.lang.UnsatisfiedLinkError dalvik.system.PathClassLoader

[英]Android java.lang.UnsatisfiedLinkError dalvik.system.PathClassLoader

i am trying to access to some hikvision cctv cameras.我正在尝试访问一些海康威视闭路电视摄像机。 I have got the so files and the jar files.我有 so 文件和 jar 文件。 when i try to run the program it says当我尝试运行它说的程序时

 Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/idonic.mobileapp.androidhikvision-1/base.apk"],nativeLibraryDirectories=[/data/app/idonic.mobileapp.androidhikvision-1/lib/arm, /data/app/idonic.mobileapp.androidhikvision-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libMPCtrl.so"
                                                                                   at java.lang.Runtime.loadLibrary(Runtime.java:367)
                                                                                   at java.lang.System.loadLibrary(System.java:1076)
                                                                                   at org.MediaPlayer.PlayM4.Player.<clinit>(Player.java:775)
                                                                                   at idonic.mobileapp.androidhikvision.PlayBackByTime$LoadingDevicesTask.doInBackground(PlayBackByTime.java:80)
                                                                                   at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                                                   at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                   at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
                                                                                   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                                   at java.lang.Thread.run(Thread.java:818) 

The error occurs when i try to call当我尝试调用时发生错误

 player = Player.getInstance();

this is the current structure of my program这是我程序的当前结构

当前结构

The error says it cannot find the path in some folder that is not my project so i think i am missing some thing.该错误表明它无法在不是我的项目的某个文件夹中找到路径,所以我想我遗漏了一些东西。 maybe i need to declare the new folder where the so files are located.也许我需要声明 so 文件所在的新文件夹。

this is my build.gradle这是我的 build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "idonic.mobileapp.androidhikvision"
    minSdkVersion 10
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner   "android.support.test.runner.AndroidJUnitRunner"
    externalNativeBuild {
        cmake {
            cppFlags "-frtti -fexceptions"
        }
    }
    ndk {
        abiFilters "armeabi", "armeabi-v7a"

    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
externalNativeBuild {
    cmake {
        path "CMakeLists.txt"
    }
 }
sourceSets {
    main {
        jniLibs.srcDirs = ['jniLibs']
        jni.srcDirs = [] //disable automatic ndk-build
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/HCNetSDK.jar')
compile files('libs/PlayerSDK.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

I am testing in a xiaomi redmi note 4 with android 6/MIUI8.5.3.0.我正在使用 android 6/MIUI8.5.3.0 在 xiaomi redmi note 4 中进行测试。 The gradle version is 2.3 and android studio is 3.0. gradle版本是2.3,android studio是3.0。 i have try to load the project in other devices and in the device with android 5.0 the code works and i can see image from the cctv camera.我已经尝试在其他设备和带有 android 5.0 的设备中加载项目,代码有效,我可以看到来自闭路电视摄像机的图像。 the other devices were and s7 with android 7.1.其他设备是 s7 和 android 7.1。 What i am missing.... Thanks in advance..我错过了什么....提前致谢..

I was facing the same problem after using the latest Android version > 25. Here is how i fixed the problem. 使用最新的Android版本> 25后,我遇到了同样的问题。这是我解决问题的方式。

  1. create three folder under app/jniLibs 在app / jniLibs下创建三个文件夹

    a. 一种。 app/jniLibs/x86 b. app / jniLibs / x86 b。 app/jniLibs/armeabi c. app / jniLibs / armeabi c。 app/jniLibs/armeabi-v7a 应用程序/ jniLibs / armeabi-v7a

As shown in the picture below Add folders 如下图所示添加文件夹

  1. Create a gradle.properties file under rood folder. 在rood文件夹下创建gradle.properties文件。 Right click on the root of the folder, which would be 99% app folder > New file > name it gradle.properties 右键单击文件夹的根目录,该目录将是99% 应用程序文件夹>新建文件>将其命名为gradle.properties

  2. Paste the following line 粘贴以下行

    android.useDeprecatedNdk=true -> gradle.properties android.useDeprecatedNdk = true- > gradle.properties

  3. Add following lines inside build.gradle(Module: app) 在build.gradle(Module:app)中添加以下行

 android{ .... defaultConfig{ ndk { abiFilters "armeabi-v7a", "x86", "armeabi" } .... } 
  1. Run the app with you finger crossed. 手指交叉运行该应用程序。

I also got into this problem, and I had to add also this in App Manifest file:我也遇到了这个问题,我还必须在 App Manifest 文件中添加:

<application
    android:extractNativeLibs="true" ...

Always use the last technical advice: keep you finger crossed.始终使用最后的技术建议:祈祷吧。

暂无
暂无

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

相关问题 java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader - java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList - java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList PID:15208 java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader - PID: 15208 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader 启用proguard功能后,崩溃:java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader - after enable proguard feature, crash: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader加载echoprint-jni - java.lang.UnsatisfiedLinkError: Couldn't load echoprint-jni from loader dalvik.system.PathClassLoader java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList ...]找不到“libdetection_based_tracker.so” - java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList…] couldn't find “libdetection_based_tracker.so” 由以下原因引起:java.lang.UnsatisfiedLinkError:无法从加载器dalvik.system.PathClassLoader findLibrary加载gnustl_shared返回null - Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gnustl_shared from loader dalvik.system.PathClassLoader findLibrary returned null java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader加载NativeMorphoSmartSDK_6.13.2.0-4.1 - java.lang.UnsatisfiedLinkError: Couldn't load NativeMorphoSmartSDK_6.13.2.0-4.1 from loader dalvik.system.PathClassLoader java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader加载和enginephysicsbox2dextension…findLibrary返回null - java.lang.UnsatisfiedLinkError: Couldn't load andenginephysicsbox2dextension from loader dalvik.system.PathClassLoader… findLibrary returned null 无法加载vlcjni库:java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList找不到“ libvlcjni.so” - Can't load vlcjni library: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList couldn't find “libvlcjni.so”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM