Cross-platform and non-web GUI library for 馃 Rust powered by 馃帹 Skia. freyaui.dev
README.md

Experimental Android Support #

Warning

Android support is highly experimental. Soft keyboard and IME support are not yet implemented, so Input components and anything relying on keyboard input will not work properly on Android.

Prerequisites #

With Nix (x86_64 Linux) #

From the repository root, enter the Android development shell:

nix develop .#android

The shell provides Rust with both Android targets, cargo-ndk, Java 17, ADB, SDK platforms 36 and 36.1, build tools 36.0.0 and NDK r26d. The SDK and NDK environment variables are configured automatically.

Skip the manual setup below and build the example:

cd examples/android/AndroidApp
./gradlew assembleDebug

Android SDK (manual setup) #

Install Android Studio (recommended) or the Android command-line tools. API level 36 is required.

Set the following environment variables:

export ANDROID_HOME="<PATH_TO_SDK>"

If you installed Android Studio, the SDK is typically at ~/Android/Sdk (Linux), ~/Library/Android/sdk (macOS), or %LOCALAPPDATA%\Android\Sdk (Windows).

Android NDK (r26d) #

Download and extract the NDK for your platform:

Then set the following environment variables:

export ANDROID_NDK_HOME="<PATH_TO_NDK>/android-ndk-r26d"
export ANDROID_NDK="<PATH_TO_NDK>/android-ndk-r26d"

Rust tooling #

Install cargo-ndk and the required Android targets:

cargo install cargo-ndk
rustup target add aarch64-linux-android x86_64-linux-android

Building for Android #

With Android Studio #

Open the ./AndroidApp/ project in Android Studio and click Run. If you have a device connected with ADB debugging enabled, the app will launch after a successful build.

Without Android Studio #

From the ./AndroidApp/ directory:

./gradlew assembleDebug

The APK will be at app/build/outputs/apk/debug/app-debug.apk relative to the AndroidApp directory.

Installing on Your Phone #

With your phone connected and USB debugging enabled, run from examples/android/AndroidApp:

./gradlew installDebug && adb shell am start -n com.freya.androidapp/.MainActivity

Running on Desktop #

This example also compiles as a regular desktop app:

cargo run

Attribution #

This experiment is inspired by an older attempt to add Android support to Freya by rebecca-src. You can see their original branch here: https://github.com/rebecca-src/freya/tree/experiment/android/examples/android