I'm writing an Android application that relies on two prebuilt shared libraries (A and B). Both libraries are configured to work with the armeabi and armeabi-v7a architectures.
The first prebuilt library, A, is libsodium. The second prebuilt library, B, is a Rust library that depends on libsodium. When compiling the Rust prebuilt library, libsodium is used as a dependency.
Right now, I want to use my two prebuilt libraries, A & B, in my Android application. Loading A using System.loadLibrary() works just fine. But when I load B, there's an error that B can't find a method defined in A:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "crypto_sign_ed25519_detached" referenced by "libB.so"...
My Android.mk is as follows:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := sodium
LOCAL_SRC_FILES := ../jniLibs/$(TARGET_ARCH_ABI)/libsodium.so
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/sodium.h $(LOCAL_PATH)/include/sodium/
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := rust
LOCAL_SRC_FILES := ../jniLibs/$(TARGET_ARCH_ABI)/librust.so
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/sodium.h $(LOCAL_PATH)/include/sodium/
LOCAL_SHARED_LIBRARIES := sodium
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := rust-manager
LOCAL_SRC_FILES := rust-manager.c
LOCAL_SHARED_LIBRARIES := rust sodium
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/ $(LOCAL_PATH)/include/sodium.h $(LOCAL_PATH)/include/sodium/
include $(BUILD_SHARED_LIBRARY)
The rust-manager.c file is my C wrapper generated using javah that contains C functions that map my native Java functions to the Rust library, but I think it's negligible at this point. Any help would be much appreciated!