Closed opfromthestart closed 1 year ago
I found a workaround by running ./gradlew installDebug
but I would prefer a solution that works with closer to default Android Studio.
@opfromthestart You have to specify the targetDirectory
as this is because the rustJniLibs
folder is empty, this is better explained here, but in summary add this
cargo {
// ...
targetDirectory = "../path/to/target/"
}
Note: If you have problems with the
libc++_shared
library, add this to yourbuild.gradle
For what it's worth, we started seeing the same issue with Android Gradle Plugin 7.4.2+. AGP 7.4.0 worked fine without additional configuration.
The files are being copied fine but it still gives the error that it cannot find librust.so
This workaround seemed to work for me https://github.com/mozilla/rust-android-gradle/issues/118#issuecomment-1569407058
That still does not work. I updated the repo to reflect my changes
I fixed it by changing "cdylib" to "staticlib" and "dylib"
It looks like I actually fixed it by temporarily adding , "build/rustJniLibs/android/x86"
to sourceSets.main.jniLibs.srcDirs
. And yes, this did still work when building for arm64.
I am trying to do a simple example at https://github.com/opfromthestart/openfunny. No matter what I do, I always get this error when running the application. The .so files appear in both the rust/target and app/build/rustJniLibs directories, but it always gives this error. I am new to android development and have had no success for multiple hours.