Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ibaryshnikov/android-iced-example
Example of building iced for android
https://github.com/ibaryshnikov/android-iced-example
Last synced: 2 months 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 (6 months ago)
- Default Branch: master
- Last Pushed: 2024-08-13T11:51:35.000Z (5 months ago)
- Last Synced: 2024-08-13T14:44:04.797Z (5 months ago)
- Language: Rust
- Size: 450 KB
- Stars: 14
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Example of building android app with iced
Based on several other examples:
- [na-mainloop](https://github.com/rust-mobile/android-activity/tree/v0.6.0/examples/na-mainloop)
from `android-activity`
- [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.12.1/examples/integration)
from `iced`## Preview
iced integration example
![Pixel first screenshot](pixel_1.png)
![Pixed second screenshot](pixel_2.png)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_1.png)
![Watch second](watch_2.png)
![Watch third](watch_3.png)## 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
![Pixel third screenshot](pixel_3.png)
## 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.12.1/examples/integration) example.
As a result, it was possible to convert existing example running `winit` + `wgpu` to
use `iced` on top.