简体   繁体   English

无法与库项目和JNI一起运行android应用

[英]Can't run android app with library project and JNI together

I'm trying to run an android app with two relatives: 我正在尝试与两个亲戚一起运行android应用程序:

  1. CSipSimple Library project. CSipSimple库项目。

  2. .so libraries loaded using JNI. .so库使用JNI加载。

When running the app using only the .so libraries, it works perfectly, but when running it after adding the CSipSimple project, it can't find the .so library and give me the following exception: 仅使用.so库运行该应用程序时,它可以完美运行,但是在添加CSipSimple项目后运行该应用程序时,它找不到.so库并给我以下异常:

09-22 17:18:02.650: W/System.err(13662): java.lang.UnsatisfiedLinkError: Couldn't load dvr from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.automation.isolace-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.automation.isolace-2, /vendor/lib, /system/lib]]]: findLibrary returned null 09-22 17:18:02.650: W/System.err(13662): at java.lang.Runtime.loadLibrary(Runtime.java:358) 09-22 17:18:02.650: W/System.err(13662): at java.lang.System.loadLibrary(System.java:526) 09-22 17:18:02.650: W/System.err(13662): at com.company.NetSDK.INetSDK.LoadLibrarys(INetSDK.java:26) 09-22 17:18:02.650: W/System.err(13662): at com.company.NetSDK.INetSDK.(INetSDK.java:6) 09-22 17:18:02.650: W/System.err(13662): at com.automation.isolace.VideoViewActivity$3.run(VideoViewActivity.java:137) 09-22 17:18:02.650:W / System.err(13662):java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader [DexPathList [[zip文件“ / data / app / com。 automation.isolace-2.apk“],nativeLibraryDirectories = [/ data / app-lib / com.automation.isolace-2,/ vendor / lib,/ system / lib]]]:findLibrary返回null 09-22 17:18 :02.650:W / System.err(13662):在java.lang.Runtime.loadLibrary(Runtime.java:358)09-22 17:18:02.650:W / System.err(13662):在java.lang。 System.loadLibrary(System.java:526)09-22 17:18:02.650:W / System.err(13662):在com.company.NetSDK.INetSDK.LoadLibrarys(INetSDK.java:26)09-22 17: 18:02.650:W / System.err(13662):在com.company.NetSDK.INetSDK。(INetSDK.java:6)09-22 17:18:02.650:W / System.err(13662):在com。 automation.isolace.VideoViewActivity $ 3.run(VideoViewActivity.java:137)

The method LoadLibraries : LoadLibraries方法:

/*    */   public static void LoadLibrarys()
/*    */   {
/*    */     try
/*    */     {
/* 17 */       String strOSType = System.getProperty("os.name");
/* 18 */       if (strOSType.contains("Window"))
/*    */       {
/* 20 */         System.loadLibrary("dhconfigsdk");
/* 21 */         System.loadLibrary("dhnetsdk");
/* 22 */         System.loadLibrary("netsdk");
/*    */       }
/*    */       else
/*    */       {
/* 26 */         System.loadLibrary("dvr");
/* 27 */         System.loadLibrary("configsdk");
/* 28 */         System.loadLibrary("netsdk");
/* 29 */         System.loadLibrary("sdk");
/*    */       }
/*    */     } catch (UnsatisfiedLinkError ulink) {
/* 32 */       ulink.printStackTrace();
/*    */     }
/*    */   }

and the Hierarchy of my app: 和我的应用程序的层次结构:

在此处输入图片说明

This probably because of the libraries in libs/armeabi & libs/armeabi-v7a are different, such as the libs/armeabi-v7a only contains a subset of .so libraries. 这可能是因为libs/armeabilibs/armeabi-v7a中的libs/armeabi-v7a不同,例如libs/armeabi-v7a仅包含.so库的子集。 When you add a library project dependency, you should check its libs/armeabi & libs/armeabi-v7a folders as well. 添加库项目依赖项时,还应检查其libs/armeabilibs/armeabi-v7a文件夹。

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

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