简体   繁体   中英

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

I'm trying to run an android app with two relatives:

  1. CSipSimple Library project.

  2. .so libraries loaded using 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:

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)

The method 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. When you add a library project dependency, you should check its libs/armeabi & libs/armeabi-v7a folders as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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