Skip to content

docs: document running Android examples with cargo-apk#1801

Open
SAY-5 wants to merge 2 commits into
linebender:mainfrom
SAY-5:docs/android-cargo-apk-how-to
Open

docs: document running Android examples with cargo-apk#1801
SAY-5 wants to merge 2 commits into
linebender:mainfrom
SAY-5:docs/android-cargo-apk-how-to

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 21, 2026

The xilem/examples/android/README.md only had a TODO placeholder asking
for cargo apk instructions. The CI workflow already installs
cargo-apk and runs cargo apk check on every Android example, but the
README left contributors without a documented path from "I want to run
this on my phone" to a working command.

This fills in the README with the prerequisites (Android SDK / NDK envvars,
an Android rustup target, cargo-apk), the build invocation, and the
install/run invocation, using the same package and example selectors that
CI uses (-p xilem --example <name>).

Fixes #1780

The xilem/examples/android/README only had a TODO note asking for
cargo-apk instructions. The CI workflow already installs cargo-apk and
runs 'cargo apk check' against each Android example, but contributors
hitting the README had no path from 'I want to run this' to a working
command.

Document the prerequisites (Android SDK / NDK envvars, an Android rustup
target, cargo-apk), the build invocation, and the install/run invocation,
using the same package and example selectors as CI.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@PoignardAzur PoignardAzur requested a review from DJMcNab May 30, 2026 10:56
Copy link
Copy Markdown
Contributor

@PoignardAzur PoignardAzur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to include a mention of Android Studio and the whole mess of setting up a connected device/emulator, but this is already a huge improvement.

@PoignardAzur
Copy link
Copy Markdown
Contributor

@DJMcNab You have more experience building Xilem on android than me, anything to add?

Otherwise I'll merge this in a few days.

Copy link
Copy Markdown
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me. The locked comment is blocking, but otherwise this can land from my perspective.

I'd maybe consider reordering the section about being cargo apk build, and instead move it to be similar to how check is mentioned. But that's a personal preference thing, and this way around is still an improvement.

Comment thread xilem/examples/android/README.md Outdated
- `cargo-apk` itself:

```sh
cargo install cargo-apk
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cargo install cargo-apk
cargo install cargo-apk --locked

cargo apk build -p xilem --example calc_android
```

The supported examples are `calc_android`, `emoji_picker_android`, `http_cats_android`, `mason_android`, `stopwatch_android`, `to_do_mvc_android`, and `variable_clock_android`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to list these all here (not unreasonably), then we need a comment in the Cargo.toml which defines these to also update this when adding one.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@SAY-5
Copy link
Copy Markdown
Author

SAY-5 commented May 31, 2026

Applied both suggestions in d582b60: added --locked to the install command and added a cross-reference comment in xilem/Cargo.toml next to the existing ANDROID_TARGETS note so the README list gets updated when new examples are added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document how to run examples on Android

3 participants