Not sure if it's helpful to you, I did that a couple of weeks ago for a library, but I'm using Cmake (which is now the preferred way for building C++ on android studio). I compiled the library from the source code online.
On my cmake i have this block
set(CMAKE_SYSROOT_OLD ${CMAKE_SYSROOT})
set(CMAKE_SYSROOT "")
find_library(lib_crypto NAMES crypto
HINTS ${OPENSSL_LIB_DIR}/${CMAKE_ANDROID_ARCH_ABI})
set(CMAKE_SYSROOT ${CMAKE_SYSROOT_OLD})
I had to wrap the find_library with those calls as a workaround to be able to find the library with the path specified.
then on the block target_link_libraries
target_link_libraries(${PROJECT_NAME}
${lib_crypto}
)
on my build.gradle file i specify where is the path that contains the folders with the .so for the different architectures
android {
defaultConfig {
externalNativeBuild {
cmake {
cppFlags '-std=c++17'
arguments "-DOPENSSL_LIB_DIR="+"/Users/bloom/sw_develop/Libraries/openssl/build"
arguments "-DOPENSSL_LIB_DIR="+"/Users/bloom/sw_develop/Libraries/openssl/build"
}
}
}
}
Of course I set up also the path for the include files with this line:
include_directories( ${OPENSSL_INCLUDE_DIR} )
Hope it helps or at least points you on the right direction.