I have a JNI library that was made to be used by Android app with NDK. I do not have sources, only compiled .so files for some archs.
I want to call functions from this library in a simple console Java application on a 64-bit x86 linux PC.
What I've done:
System.loadLibrary
liblog.so: cannot open shared object file: No such file or directory
.libstdc++.so: cannot open shared object file: No such file or directory
/usr/lib/x86_64-linux-gnu/libc.so: invalid ELF header
.undefined symbol: __stack_chk_guard
comment. Looks like my library is strongly tightened with Android thingsWhat should I do to use this library in my normal program without anything Android-specific?
Using Android Studio 2.2 and higher, you can use the NDK to compile C and C++ code into a native library and package it into your APK using Gradle, the IDE's integrated build system. Your Java code can then call functions in your native library through the Java Native Interface (JNI) framework.
JNI is just the way that Java handles calling into native/C++ code, and calling back into Java from there. It has nothing to say about Android - it is a Java language feature. The Android NDK is a way to write Android applications using code called by JNI.
Just in few words - Android and desktop Linux binaries are incompatible, even if they are targeted to the same CPU architecture.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With