All Projects → rust-windowing → Android Ndk Rs

rust-windowing / Android Ndk Rs

Licence: other
Rust bindings to the Android NDK

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Android Ndk Rs

GTKAndroid
GTK+Android
Stars: ✭ 73 (-63.5%)
Mutual labels:  android-ndk
Pjproject
PJSIP project
Stars: ✭ 786 (+293%)
Mutual labels:  android-ndk
Termux Ndk
android-ndk for termux
Stars: ✭ 91 (-54.5%)
Mutual labels:  android-ndk
dlib-for-android
Compile and embed Dlib in your Android projects with ease.
Stars: ✭ 33 (-83.5%)
Mutual labels:  android-ndk
Vulkan
Vulkan API bindings for Go programming language
Stars: ✭ 559 (+179.5%)
Mutual labels:  android-ndk
Android Ndk
Туториалы и примеры использования Android ndk.
Stars: ✭ 36 (-82%)
Mutual labels:  android-ndk
Inimesed
An Android app that lets you search your contacts by voice. Internet not required. Based on Pocketsphinx. Uses Estonian acoustic models.
Stars: ✭ 65 (-67.5%)
Mutual labels:  android-ndk
Ffmpeg Android
FFmpeg for Android compiled with x264, libass, fontconfig, freetype, fribidi and lame (Supports Android 4.1+)
Stars: ✭ 1,554 (+677%)
Mutual labels:  android-ndk
Gainput
Cross-platform C++ input library supporting gamepads, keyboard, mouse, touch
Stars: ✭ 636 (+218%)
Mutual labels:  android-ndk
Ndcrash
A powerful crash reporting library for Android NDK. Don't forget to run git submodule update --init --recursive after checking out.
Stars: ✭ 91 (-54.5%)
Mutual labels:  android-ndk
flutter native opencv
Using OpenCV natively in C++ in a Flutter app with Dart FFI
Stars: ✭ 104 (-48%)
Mutual labels:  android-ndk
Hp Socket
High Performance TCP/UDP/HTTP Communication Component
Stars: ✭ 4,420 (+2110%)
Mutual labels:  android-ndk
Android Ndk
[Deprecated] Installed android-ndk for speedy cloning into Travis CI worker VM.
Stars: ✭ 38 (-81%)
Mutual labels:  android-ndk
native-libandroidthings
NDK library for exposing Peripheral I/O APIs in C/C++
Stars: ✭ 28 (-86%)
Mutual labels:  android-ndk
Cocos2d X 3rd Party Libs Src
Dependencies of cocos2d-x.
Stars: ✭ 107 (-46.5%)
Mutual labels:  android-ndk
gooid
Go bindings for Android NDK
Stars: ✭ 48 (-76%)
Mutual labels:  android-ndk
Lxc For Android 7.1.2
The repository contains the lxc and related tools/packages for Android 7.1.2, build scripts are provide for compiling lxc with Android standalone NDK.
Stars: ✭ 31 (-84.5%)
Mutual labels:  android-ndk
Mwengine
Audio engine and DSP for Android, written in C++ providing low latency performance in a musical context, supporting both OpenSL and AAudio.
Stars: ✭ 190 (-5%)
Mutual labels:  android-ndk
Face Swap Android
Realtime Face Swap Android NDK app full source code. Developed with OpenCV (http://opencv.org) and Dlib C++ (http://dlib.net).
Stars: ✭ 111 (-44.5%)
Mutual labels:  android-ndk
Bugsnag Android Ndk
DEPRECATED - this project now lives at bugsnag/bugsnag-android
Stars: ✭ 42 (-79%)
Mutual labels:  android-ndk

Rust on Android

Rust MIT license APACHE2 license

Libraries and tools for Rust programming on Android targets:

Name Description Badges
ndk-sys Raw FFI bindings to the NDK crates.io crates.io
ndk Safe abstraction of the bindings crates.io crates.io
ndk-glue Startup code crates.io crates.io
ndk-build Everything for building apk's crates.io crates.io
cargo-apk Build tool crates.io crates.io

See ndk-examples for examples using the NDK and the README files of the crates for more details.

Hello world

Quick start for setting up a new project with support for Android. For communication with the Android framework in our native Rust application we require a NativeActivity. ndk-glue will do the necessary initialization when calling main but requires a few adjustments:

Cargo.toml

[lib]
crate-type = ["lib", "cdylib"]

Wraps main function using attribute macro ndk::glue::main:

src/lib.rs

#[cfg_attr(target_os = "android", ndk_glue::main(backtrace = "on"))]
pub fn main() {
    println!("hello world");
}

src/main.rs

fn main() {
    $crate::main();
}

Install cargo apk for building, running and debugging your application:

cargo install cargo-apk

We can now directly execute our Hello World application on a real connected device or an emulator:

cargo apk run

Logging and stdout

Stdout is redirected to the android log api when using ndk-glue. Any logger that logs to stdout, like println!, should therefore work.

Use can filter the output in logcat

adb logcat RustStdoutStderr:D *:S

Android logger

Android logger can be setup using feature "logger" and attribute macro like so:

src/lib.rs

#[cfg_attr(target_os = "android", ndk_glue::main(logger(level = "debug", tag = "my-tag")))]
pub fn main() {
    log!("hello world");
}

Overriding crate paths

The macro ndk_glue::main tries to determine crate names from current Cargo.toml. In cases when it is not possible the default crate names will be used. You can override this names with specific paths like so:

#[ndk_glue::main(
  ndk_glue = "path::to::ndk_glue",
  logger(android_logger = "path::to::android_logger",
         log = "path::to::log")
)]
fn main() {}

JNI

Java Native Interface (JNI) allows executing Java code in a VM from native applications. ndk-examples contains an jni_audio example which will print out all output audio devices in the log.

  • jni, JNI bindings for Rust

Winit and glutin

TODO shameless plug

Flutter

TODO shameless plug

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].