I'm trying to figure out how to integrate my native lib into android code. I create a simple C++ function and it's work fine when running code on device. However my current goal is to make it work in unit-test env (junit), and I faced with problems:
So, in unit-test env System.loadLibrary("lib")
not working, and I cange it to
System.load("/full/path/to/lib.so")
, but now this line throw an exception:
java.lang.UnsatisfiedLinkError: app\build\intermediates\cmake\debug\obj\x86_64\liblib.so: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824) at java.lang.Runtime.load0(Runtime.java:809) at java.lang.System.load(System.java:1086)
Path is correct and there is a file by this path exists.
I tryed to use path to x86
based version of lib, but it's still throw the same exception.
I'm using latest Android NDK, Clang toolchain, running unit-tests on Windows 7 64 bit based laptop, CPU is Core i7, and java version in runtime also seems to be 64 bit.
So what could be the problem in this case and how to fix it?
I have a feeling that even having in mind fact that clang compile x86/x86_64 *.so files, they are still invalid in windows based env, but I don't have linux installed to quickly check this idea.