I have a weird error where it says:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot find \"./obj/local/armeabi-v7a/libsharedlibrary.so\" from verneed[
libsharedlibrary.so is missing its SONAME entry. You probably currently see something like the following:
$ readelf -dW libnative.so | grep NEEDED | grep libsharedlibrary
0x0000000000000001 (NEEDED) Shared library: [./obj/local/armeabi-v7a/libsharedlibrary.so]
Note that if you don't have readelf on your system it is provided in the NDK as $NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-readelf (adjust the path as necessary for your OS). Note that the architecture here doesn't actually matter. readelf is a multi-arch tool. Any toolchain's readelf will work fine.
What you should see if libsharedlibrary.so was built with SONAME is:
$ readelf -dW libnative.so | grep NEEDED | grep libsharedlibrary
0x0000000000000001 (NEEDED) Shared library: [libsharedlibrary.so]
You should see the following on libsharedlibrary.so:
$ readelf -dW libsharedlibrary.so | grep SONAME
0x000000000000000e (SONAME) Library soname: [libsharedlibrary.so]
The problem is that libsharedlibrary.so was not built with the -Wl,-soname,libsharedlibrary.so
ldflag. ndk-build and CMake will do that for you, but if you're using a standalone toolchain or a custom build system then you need to provide it yourself.