Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions adapters/android/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ categories.workspace = true
keywords = ["gui", "ui", "accessibility"]
repository.workspace = true
readme = "README.md"
exclude = ["examples"]
edition.workspace = true
rust-version.workspace = true

Expand All @@ -20,3 +21,9 @@ accesskit_consumer = { version = "0.39.0", path = "../../accesskit_consumer" }
jni = "0.21.1"
log = "0.4.17"

[dev-dependencies]
example_common = { path = "../../example_common" }

[[example]]
name = "hello_world"
crate-type = ["cdylib"]
15 changes: 15 additions & 0 deletions adapters/android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,18 @@ This adapter is implemented in two layers:
* The `InjectingAdapter` struct injects accessibility into an arbitrary Android view without requiring the view class to be modified, at the expense of depending on a specific Java class and providing less flexibility in the aspects listed above.

The most convenient way to use `InjectingAdapter` is to embed a precompiled `.dex` file containing the associated Java class and its inner classes into the native code. This approach requires the `embedded-dex` Cargo feature.

## Example

The `examples/` directory contains a runnable example built on the low-level `Adapter`:

### Running the example

Install [cargo-ndk](https://github.com/bbqsrc/cargo-ndk) (version 4 or later) and the Rust target for your device, e.g. `rustup target add aarch64-linux-android`. The Android SDK must be discoverable by Gradle (through `ANDROID_HOME` or a `local.properties` file), and cargo-ndk needs an NDK, which it finds inside the SDK or through `ANDROID_NDK_HOME`. Then, with a device connected or an emulator running:

```sh
cd examples/hello_world_app
./gradlew installDebug
```

By default, the Rust library is only built for `arm64-v8a`. Pass `-PrustAbis=arm64-v8a,x86_64` to build for additional ABIs, such as for an emulator on an x86-64 host. The project can also be opened in Android Studio.
Loading
Loading