Skip to content

Commit db099e9

Browse files
authored
[Android docs] Add maven part
Now user can also add executorch android lib as a maven dependency.
1 parent 4e1d2e5 commit db099e9

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

docs/source/using-executorch-android.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Note: This page covers Android app integration through the AAR library. The Exec
66

77
## Installation
88

9-
All ExecuTorch Android libraries are packaged into an Android library (AAR), `executorch.aar` for both generic (image/audio processing) and LLM (LLaMA) use case. In each release, prebuilt AAR artifacts are uploaded to S3. Users can also build the AAR from source.
9+
All ExecuTorch Android libraries are packaged into an [Android library (AAR)](https://developer.android.com/studio/projects/android-library), `executorch.aar` for both generic (image/audio processing) and LLM (LLaMA) use case. In each release, prebuilt AAR artifacts are uploaded to [Maven](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/) and S3. Users can also build the AAR from source.
1010

1111
### Contents of library
1212

@@ -22,7 +22,21 @@ The AAR artifact contains the Java library for users to integrate with their Jav
2222
- LLaMa-specific Custom ops library.
2323
- Comes with two ABI variants, arm64-v8a and x86\_64.
2424

25-
## Downloading AAR
25+
## Using AAR from Maven Central
26+
27+
Simply add the following `org.pytorch:executorch-android` to your Android app dependency (build.gradle), and build your app.
28+
29+
For example:
30+
```
31+
# app/build.gradle.kts
32+
dependencies {
33+
implementation("org.pytorch:executorch-android:0.5.1")
34+
}
35+
```
36+
37+
## Using AAR file directly
38+
39+
You can also directly specify an AAR file in the app. We upload pre-built AAR to S3 during each release, or as a snapshot.
2640

2741
### Released versions (recommended)
2842

@@ -36,13 +50,13 @@ The AAR artifact contains the Java library for users to integrate with their Jav
3650
| ------- | --- | ------- |
3751
| 2025-02-27 | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/executorch-20250227/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/executorch-20250227/executorch.aar.sha256sums) |
3852

39-
## Using prebuilt libraries
53+
## Using AAR file
4054

41-
To add the Java library to your app:
55+
To add the AAR file to your app:
4256
1. Download the AAR.
4357
2. Add it to your gradle build rule as a file path.
4458

45-
An AAR file itself does not contain dependency info. 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:
59+
An AAR file itself does not contain dependency info, unlike the Maven one which bundled with pom.xml. 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:
4660
```
4761
implementation("com.facebook.soloader:soloader:0.10.5")
4862
implementation("com.facebook.fbjni:fbjni:0.5.1")
@@ -58,7 +72,7 @@ curl https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/execut
5872

5973
And include it in gradle:
6074
```
61-
# app/build.grardle.kts
75+
# app/build.gradle.kts
6276
dependencies {
6377
implementation(files("libs/executorch.aar"))
6478
implementation("com.facebook.soloader:soloader:0.10.5")
@@ -77,9 +91,10 @@ You need Android [SDK](https://developer.android.com/studio) and [NDK](https://d
7791

7892
Current NDK version used in ExecuTorch CI: r27b.
7993

80-
You need to set `ANDROID_NDK` to the correct NDK root (containing NOTICE file).
94+
You need to set `ANDROID_HOME` to Android SDK home and `ANDROID_NDK` to the correct NDK root (containing NOTICE file).
8195

8296
```
97+
export ANDROID_HOME=/path/to/sdk
8398
export ANDROID_NDK=/path/to/ndk
8499
sh build/build_android_library.sh
85100
```

0 commit comments

Comments
 (0)