Skip to content

Commit 7535a54

Browse files
authoredFeb 28, 2025
[Android docs] Minor update to existing sections (#8802)
1 parent ebcd90e commit 7535a54

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed
 

‎docs/source/using-executorch-android.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
# Using ExecuTorch on Android
22

3-
To use from Android, ExecuTorch provides Java API bindings and Android platform integration, available as a AAR file. The ExecuTorch C++ APIs can also be used from Android native.
3+
To use from Android, ExecuTorch provides Java/Kotlin API bindings and Android platform integration, available as an AAR file.
4+
5+
Note: This page covers Android app integration through the AAR library. The ExecuTorch C++ APIs can also be used from Android native, and the documentation can be found on [this page about cross compilation](https://pytorch.org/executorch/main/using-executorch-building-from-source.html#cross-compilation).
46

57
## Installation
68

7-
We provide a prebuilt Android library (AAR), `executorch.aar` for both generic (image/audio processing) and LLAMA use case.
9+
We package all ExecuTorch Android libraries into an Android library (AAR), `executorch.aar` for both generic (image/audio processing) and LLM (LLaMA) use case. In each release, we will upload the prebuilt AAR artifacts. Users can also build the AAR from source.
10+
11+
### Contents of library
812

9-
## Contents of library
10-
- `executorch.aar`
11-
- [Java library](https://github.com/pytorch/executorch/tree/main/extension/android/src/main/java/org/pytorch/executorch)
12-
- JNI contains the JNI binding for the corresponding Java code, and ExecuTorch native library, including core ExecuTorch runtime libraries, XNNPACK backend, Portable kernels, Optimized kernels, Quantized kernels, and LLAMA-specific Custom ops library.
13-
- Comes with two ABI variants, arm64-v8a and x86\_64.
13+
The AAR artifact contains the Java library for users to integrate with their Java/Kotlin application code, as well as the corresponding JNI library (.so file), which is loaded by the Java code during initialization.
14+
15+
- [Java library](https://github.com/pytorch/executorch/tree/main/extension/android/src/main/java/org/pytorch/executorch)
16+
- JNI contains the JNI binding for the corresponding Java code, and ExecuTorch native library, including
17+
- core ExecuTorch runtime libraries
18+
- XNNPACK backend
19+
- Portable kernels
20+
- Optimized kernels
21+
- Quantized kernels
22+
- LLaMa-specific Custom ops library.
23+
- Comes with two ABI variants, arm64-v8a and x86\_64.
1424

1525
## Downloading AAR
1626

@@ -28,19 +38,31 @@ We provide a prebuilt Android library (AAR), `executorch.aar` for both generic (
2838

2939
## Using prebuilt libraries
3040

31-
To add the Java library to your app, simply download the AAR, and add it to your gradle build rule.
41+
To add the Java library to your app:
42+
1. Download the AAR.
43+
2. Add it to your gradle build rule as a file path.
44+
45+
The Java package requires `fbjni` and `soloader`, and currently requires users to explicitly declare the dependency. Therefore, two more `dependencies` in gradle rule is required:
46+
```
47+
implementation("com.facebook.soloader:soloader:0.10.5")
48+
implementation("com.facebook.fbjni:fbjni:0.5.1")
49+
```
50+
51+
### Example usage
3252

33-
In your app working directory, such as example executorch/examples/demo-apps/android/LlamaDemo,
53+
In your app working directory, such as executorch/examples/demo-apps/android/LlamaDemo,
3454
```
3555
mkdir -p app/libs
36-
curl https://ossci-android.s3.amazonaws.com/executorch/release/executorch-241002/executorch.aar -o app/libs/executorch.aar
56+
curl https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar -o app/libs/executorch.aar
3757
```
3858

3959
And include it in gradle:
4060
```
4161
# app/build.grardle.kts
4262
dependencies {
4363
implementation(files("libs/executorch.aar"))
64+
implementation("com.facebook.soloader:soloader:0.10.5")
65+
implementation("com.facebook.fbjni:fbjni:0.5.1")
4466
}
4567
```
4668

0 commit comments

Comments
 (0)