https://github.com/ibaryshnikov/android-iced-example
Example of building iced for android
https://github.com/ibaryshnikov/android-iced-example
android iced rust webgpu wgpu winit
Last synced: 29 days ago
JSON representation
Example of building iced for android
- Host: GitHub
- URL: https://github.com/ibaryshnikov/android-iced-example
- Owner: ibaryshnikov
- License: mit
- Created: 2024-07-01T02:53:17.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-01-23T07:46:39.000Z (4 months ago)
- Last Synced: 2025-04-19T14:57:55.936Z (about 2 months ago)
- Topics: android, iced, rust, webgpu, wgpu, winit
- Language: Rust
- Homepage:
- Size: 517 KB
- Stars: 41
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Example of building android app with iced
There are [NativeActivity](./NativeActivity) and [GameActivity](./GameActivity) examples here.
Based on several other examples:
- `na-mainloop` and `agdk-mainloop` from
[android-activity](https://github.com/rust-mobile/android-activity/tree/v0.6.0/examples)
- [na-winit-wgpu](https://github.com/rust-mobile/rust-android-examples/tree/main/na-winit-wgpu)
from `rust-android-examples`
- [integration](https://github.com/iced-rs/iced/tree/0.13.1/examples/integration)
from `iced`## Preview
iced integration example

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


## 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 supportedCopy/paste and show/hide soft keyboard is implemented by calling Java

## Building and running
Check `android-activity` crate for detailed instructions.
During my tests I was running the following command and using android studio afterwards:```bash
export ANDROID_NDK_HOME="path/to/ndk"
export ANDROID_HOME="path/to/sdk"rustup target add x86_64-linux-android
cargo install cargo-ndkcargo 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](https://github.com/iced-rs/iced/tree/0.13.1/examples/integration) example.
As a result, it was possible to convert existing example running `winit` + `wgpu` to
use `iced` on top.