Gradle Plugin for compatibility between Rust Code and TypeScript Code for Android. For this plugin, you need to have Cargo and the Android NDK (Native Development Kit) installed.
This project uses the following dependencies:
Name | Author | License |
---|---|---|
antlr4 | Antlr Project | BSD-3 Clause License |
Java Annotations | JetBrains | Apache-2.0 License |
Night Config (Toml) | TheElectronWill | GNU Lesser General Public License 3.0 |
You can configure the plugin with the react-native-rust
section in your build.gradle
. The following code shows an example (In the rustBaseFolder
you can create cargo projects):
react-native-rust {
basePackage = "com.user.example"
rustBaseFolder = "src/main/rust"
androidApiVersion = 33 as Byte
cargoFile = file("%CARGO_PATH%") // Optional, defaulted to cargo executable
ndkFolder = file("%NDK_FOLDER%") // Optional, defaulted to NDK_HOME env variable
module('rust-module-name') // Add module to list
}
After the configuration, you can run three tasks:
javaCodeGen
- Generate Java-side Code by the Rust code in the projectscargoCompile
- Compile all Rust projects in base foldernativeBundle
- Move all rust library files to thesrc/main/jniLibs
folder