{"id":20114094,"url":"https://github.com/davidb/experiment_android_rust","last_synced_at":"2025-08-16T13:44:05.877Z","repository":{"id":66431636,"uuid":"232195025","full_name":"davidB/experiment_android_rust","owner":"davidB","description":"experimentations for using rust on android \u0026 oculus quest","archived":false,"fork":false,"pushed_at":"2020-01-11T22:10:59.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-09T16:09:32.600Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-06T22:14:37.000Z","updated_at":"2020-01-11T22:11:02.000Z","dependencies_parsed_at":"2023-02-22T09:45:14.821Z","dependency_job_id":null,"html_url":"https://github.com/davidB/experiment_android_rust","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidB/experiment_android_rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fexperiment_android_rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fexperiment_android_rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fexperiment_android_rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fexperiment_android_rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidB","download_url":"https://codeload.github.com/davidB/experiment_android_rust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fexperiment_android_rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270718821,"owners_count":24633695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T18:28:09.049Z","updated_at":"2025-08-16T13:44:05.822Z","avatar_url":"https://github.com/davidB.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Experiment android \u0026 rust (\u0026 oculus quest ?)\n\nThis repo store my journey/exploration about using Rust with android (maybe to create an Oculus quest app mainly in rust).\n\n## Setup\n\nInstall:\n\n- OpenJDK 1.8 from [AdoptOpenJDK - Open source, prebuilt OpenJDK binaries](https://adoptopenjdk.net/)\n- Android Studio from [Download Android Studio and SDK tools  |  Android Developers](https://developer.android.com/studio/)\n  \n  via `Android Studio \u003e Preferences \u003e Appearance \u0026 Behaviour \u003e Android SDK \u003e SDK Tools`\n\n  - Android SDK Tools\n  - NDK\n  \n  There are other way to install `android-sdk` and `android-ndk` (download + unzip or brew or ...) this is the most common way.\n- rust via [rustup.rs - The Rust toolchain installer](https://rustup.rs/)\n\n  and also install some android target platform:\n\n    ```sh\n    rustup target install armv7-linux-androideabi\n    rustup target install arm-linux-androideabi\n    rustup target install aarch64-linux-android\n    rustup target install i686-linux-android\n    rustup target install x86_64-linux-android\n    ```\n\n## Experimentations\n\n### `exp_0`\n\nI try to create shell script to setup the environment variables (PATH, platform,...) like in articles or some samples I found.\nBut it was not enough reliable/portable to my taste.\n\n### `exp_1`\n\nA simple Android App that display a \"hello world\" string computed on rust side, based on the article [Building and Deploying a Rust library on Android](https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html) but\n\n- without shell script to setup environment (except java \u0026 rust path)\n- with use of [mozilla/rust-android-gradle](https://github.com/mozilla/rust-android-gradle) to build rust code from gradle, the rust lib/module is named `rust`\n- run a java unit test that call rust code (via `./gradlew test`, on Android Studio it requires custom configuration).\n\nThe project can be setup, build (and launch) from Android Studio, or from shell `./gradlew test`, ...  like a 100% Java / Kotlin android project project.\n\n*Note: Do not write the jvm code to bind to rust (via jni) into Kotlin because it generate not friendly name for rust function to implement (longer than Java and with number), so stay with Java for this class.*\n\nA cool point is that Android studio know where is `android-sdk`, `android-ndk`,... and share the information with gradle via `local.properties` so it's become more portable project.\n\n### `exp_2`\n\n- Based on `exp_1`\n- MainActivity delegates calls to rust code\n- Rust code logs via ndk (use crate `android_logger`)\n\n### TODO\n\n- allow to run some test on desktop\n- create templates for future projects\n- explore logger (from ndk) [android_logger](https://crates.io/crates/android_logger)\n- explore interaction with java api via [MaulingMonkey/jni-bindgen](https://github.com/MaulingMonkey/jni-bindgen/tree/master/jni-android-sys) or other crates\n- explore oculus vr mobile sdk\n  - bind and launch in headset\n  - display a cude\n  - use vulkan\n  - use a graphics library like rendy\n  \n## Links\n\n### Articles\n\n- [Building and Deploying a Rust library on Android](https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html), the basic and could be simplify / automate with tools\n- [Rust for NDK development - Hoang Phan](https://hoangpq.github.io/posts/rust-ndk/) based on (or update) the article above provided by mozilla + more samples \u0026 details, integration ith kotlin,...\n\n### Tools \u0026 libs\n\n- [mozilla/rust-android-gradle](https://github.com/mozilla/rust-android-gradle) Cross compile Rust Cargo projects for Android targets.\n- [bbqsrc/cargo-ndk: Compile Rust projects against the Android NDK without hassle](https://github.com/bbqsrc/cargo-ndk)\n- [cargo-apk](https://crates.io/crates/cargo-apk) Cargo subcommand that allows you to build Android packages (last release 0.4.0 2017-12)\n- [snipsco/dinghy: Easier cross-compilation for phones and single boards computers](https://github.com/snipsco/dinghy) - [android-ndk](https://crates.io/crates/android-ndk) Safe Rust bindings to the Android NDK\n- [MaulingMonkey/jni-bindgen: Generate Rust JVM FFI wrappers around APIs defined by .jar or .class files, because maintaining your own hand-written bindings is an exercise in boredom, soundness bugs, and pain.](https://github.com/MaulingMonkey/jni-bindgen)\n- [ffizer/ffizer: ffizer is a files and folders initializer / generator. Create any kind (or part) of project from template.](https://github.com/ffizer/ffizer/), I'll try to create template for project on android+rust \u0026 android+rust+oculus\n- [mb64/android-ndk-rs: Rust bindings to the Android NDK](https://github.com/mb64/android-ndk-rs)\n- [Nercury/android_logger-rs: A Rust logging implementation for `log` which hooks to android log output](https://github.com/Nercury/android_logger-rs)\n\n### Sample projects\n\n- [makepad/rustquest: This is a minimal example project for the Oculus Quest, written completely in Rust.](https://github.com/makepad/rustquest), made to build on linux, I  tied to adapt it for mac osx but got some strange error, so I decided to make my journey from scratch.\n- [kennytm/rust-ios-android: Example project for building a library for iOS + Android in Rust.](https://github.com/kennytm/rust-ios-android)\n- [Geal/rust_on_mobile](https://github.com/Geal/rust_on_mobile) dual Android \u0026 iOS, and very old (no update since 2016)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidb%2Fexperiment_android_rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidb%2Fexperiment_android_rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidb%2Fexperiment_android_rust/lists"}