dorkhub

android-iced-example

Example of building iced for android

ibaryshnikov
Rust1618 forksMITupdated 7 months ago
git clone https://github.com/ibaryshnikov/android-iced-example.gitibaryshnikov/android-iced-example

Example of building android app with iced

There are NativeActivity and GameActivity examples here.

Based on several other examples:

Preview

iced integration example

Pixel first screenshot Pixed second screenshot

You can also run most of the examples from iced. For this omit the scene rendering part and set the background of the root container.

Watch

Watch first Watch second Watch third

Text input

Text input partially works, unresolved issues:

  • window doesn't resize on show/hide soft keyboard
  • how to change input language of soft keyboard
  • ime is not supported

Copy/paste and show/hide soft keyboard is implemented by calling Java

Pixel third screenshot

Building and running

Check android-activity crate for detailed instructions. During my tests I was running the following command and using android studio afterwards:

export ANDROID_NDK_HOME="path/to/ndk"
export ANDROID_HOME="path/to/sdk"

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

cargo ndk -t x86_64 -o app/src/main/jniLibs/  build

My setup is the following:

  • archlinux 6.9.6
  • jdk-openjdk 22
  • target api 35

How it works

Thanks to android-activity we can already build android apps in Rust, and key crates such as winit and wgpu also support building for android. iced doesn't support android out of the box, but it can be integrated with existing graphics pipelines, as shown in integration example. As a result, it was possible to convert existing example running winit + wgpu to use iced on top.

more like this

anne-key

Firmware for Anne Pro Keyboard written in Rust

Rust572

TachiSnap

TachiSnap — Pixel Snapper for animation pixel artists. Rust + WebAssembly client-side tool for cleaning up AI-generated…

HTML50

urge

The Universal Ruby Game Engine (URGE) Project

C++50

search

search projects, people, and tags