Android NDK/JNI: loadLibrary failure with dependant shared libarires -


In my project, I need to load three different shared libraries, in which the third (main one) depends on the first two . The first two names for simplicity are A & A. Library A and B are large libraries which do not interact with JNI at all and only lock the existing libraries in Android.

I have set up this kind of Android radio in my third library. There is no such system by setting MK:

  $ $ (CLEAR_VARS) LOCAL_PATH Include: $$ (MY_LOCAL_PATH) LOCAL_MODULE: = C LOCAL_SRC_FILES: = & lt; Source files & gt; LOCAL_C_INCLUDES: $ $ (MY_LOCAL_PATH) / libA / LOCAL_C_INCLUDES + = $ (MY_LOCAL_PATH) / libB / LOCAL_SHARED_LIBRARIES: = A LOCAL_SHARED_LIBRARIES + = B LOCAL_LDLIBS + = - $ $ (BUILD_SHARED_LIBRARY)  

When I loaded this library via Java:

  Fixed {System.loadLibrary ("C"); }  

Too much success.

This system works on my device as well as all my beta testers get dissatisfied link entry in their stack trace:

  java.lang. ExceptionInitializerError at & lt; Source & gt:: & lt; Line & gt; Reason: java.lang.UnconfirmedLink error at: Java.lang.Thread.run (Thread.Java: 856): The library can not be loaded: link_image [18 9 2]: 1909 The library required for 'libA.so' Could not load 'libA.so' (Load_library [1094]: java.lang.Runtime.loadLibrary (Runtime.java:370) at Java.Langu.System.Load Library (system.java / 355) on the source Library 'libA.so' is not found. & Lt; Line & gt; ...  

is changing its code in:

  static {System.loadLibrary ("A"); System.loadLibrary ("B"); System.loadLibrary ('C'); }  

That tester seems to fix the problem.

With this problem, the examiner is running a Samsung Galaxy SIII (supported by my original code) AndroidM-V7A (similar to my device) with Android 4.1.2.

Given that the single "load c" works for everyone, but a tester, this tester has a problem in the device or "correct" way to clearly load these three libraries Does it for And why would it fail for only one device?

07-26 23: 23: 29.333: D / App (13753):

Loading core ... 07-26 23: 23: 29.333: D / DelWiki (13753): trying to load lib / data /app-lib/com.foo.bar.app-2/ LibC.so 0x41bfd598 07-26 23: 23: 29.333: D / DelWiki (13753): Added lib / data /app-lib/com.foo.bar.app-2/libC.so 0x41bfd598 07-26 23:23: 29.338: D / App (13753): Core Load

Video Loading All:

  07-26 23:17 17: 50.193: D / App (12714): Loading Core ... 07-26 23: 17: 50.198: D / DelWiki (12714): Lib / DETA / AP-L B / com.foobar.app1 / lba.o0x41bfaf20 07-26 23:17 17.15: 98: d / dellwikm 12714): added shared / data /app-lib/com.foo.bar.app-1/ LibA.so 0x41bfaf20 07-26 23:17 17: 50.203: D / DelWiki (12714): found a JNI download / data / app-lib / com.foo.bar.app-1 / libA.so 0x41bfaf20, skipping init 07-26 23: 17: 50.208: D / DelWiki (12714): Trying to load Lib / data / app-Lib / Com. Foo.bar.app-1 / libB.so 0x41bfaf20 07-26 23:17 17: 50.208: D / DelWiki (12714): Added lib /data/app-lib/com.foo.bar.app-1 / LibB. Therefore 0x41bfaf20 07-26 23:17: 50.208: D / DWKVWM (12714): found / found JNI_OnLoad / data-app-lib / com.foo.bar.app-1 / libB.so 0x41bfaf20, in skipping in 07- 26 23: 17: 50.208: D / DelWiki (12714): Lib / Dta / App-Lib / Com.F. Bar.App 1 / LBC.O0x41 BIFAF 20 07-26 23:17: 50.208: D / DellWikm 12714 ): Added shared lib /data/app-lib/com.foo.bar.app-1/libC.so 0x41bfaF20 07-26 23:17: 50.208: D / App (12714): Core Load < / Code> 

Yes, working clearly in A, B, and C The right way is Android. An alternative is to use , which is supported since NDK R9.

In any case, it is important to choose a special name for the libraries you use in the project so that any system is used by the library opportunity such as libcrypto.so in the Android device and libssl.so have / system / lib , but many apps require more advanced versions of these.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -