Skip to content

davehadley/exampleAndroidRust

An Example Android Application With Rust Integration

This example package demonstrates how to build and call a Rust library from an Android application.

The Rust crate is stored in app/src/main/rust/example_rust_library. If you need to add additional crates you will need to modify app/src/main/rust/CMakeLists.txt. and add any additional CMake targets that need to be built and included in the Android APK/bundle to the list of targets in build.gradle.kts.

You will need to implement JNI bindings to call Rust code from Kotlin/Java. On the Rust side, you can use the JNI crate. On the Kotlin/Java side you can follow the Android NDK documentation.

You may need to install CMake and the Android SDK. The Android Gradle Plugin seems to demand that the CMake version in build.gradle.kts exactly matches the version installed along side your Android SDK. You may need to update this file so that the version number matches the installed version.

You may need to install additional Android targets that you wish to cross-compile to.

License

Licensed under either of

at your option.

About

An Example Android Application With Rust Integration

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published