Hi!
Ive been trying to use cargo ndk with a bigger rust library.
The library is generating Java JNI bindings through a generator called "flapigen". (So its not a direct cmake project)
After building the APK with gradlew aR, which triggers gradlew jar (For making the Java side of the generated bindings) and a gradle task for running cargo ndk -t ${arch} -o ${libsPath} build --release.
Yea.. a bit of a trip :D But in the end the APK gets generated, and properly links with the generated jar.
When i install the APK, it also loads the native library correctly, however, one of the native parts needs libc++_shared.so (for i think a rust dependency, im in a bit over my head!).
According to .. the internet it should compile with that .so when i set APP_STL:=c++_shared in Application.mk, or
android {
defaultConfig {
...
externalNativeBuild {
ndkBuild {
arguments "-DAPP_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang"
}
}
}
}
However, inspecting the APK, it doesnt have it incuded.
The error: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found: needed by /data/app/~~1wFPIY2YxMCnGcnEq7pBpA==/org.example-MjRM-ZMHEp1x9fjGfZEjrA==/base.apk!/lib/arm64-v8a/libexample_java.so in namespace classloader-namespace.
Ive tried building on NDK 20, 21 and 23, and targeting SDK 27, 28 and 29 to no avail.
Using gradle-6.7.1, if it makes a difference
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31"
Any pointers you can give me?
Thank you!
Hi!
Ive been trying to use cargo ndk with a bigger rust library.
The library is generating Java JNI bindings through a generator called "flapigen". (So its not a direct cmake project)
After building the APK with
gradlew aR, which triggersgradlew jar(For making the Java side of the generated bindings) and a gradle task for runningcargo ndk -t ${arch} -o ${libsPath} build --release.Yea.. a bit of a trip :D But in the end the APK gets generated, and properly links with the generated jar.
When i install the APK, it also loads the native library correctly, however, one of the native parts needs
libc++_shared.so(for i think a rust dependency, im in a bit over my head!).According to .. the internet it should compile with that
.sowhen i setAPP_STL:=c++_sharedinApplication.mk, orHowever, inspecting the APK, it doesnt have it incuded.
The error:
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found: needed by /data/app/~~1wFPIY2YxMCnGcnEq7pBpA==/org.example-MjRM-ZMHEp1x9fjGfZEjrA==/base.apk!/lib/arm64-v8a/libexample_java.so in namespace classloader-namespace.Ive tried building on NDK 20, 21 and 23, and targeting SDK 27, 28 and 29 to no avail.
Using gradle-6.7.1, if it makes a difference
Any pointers you can give me?
Thank you!