Skip to content

Commit dd69e7a

Browse files
committed
Add readme
1 parent ebf751f commit dd69e7a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

extension/android/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# ExecuTorch Android
2+
3+
This directory contains the Android Java/Kotlin binding. The final product is an AAR,
4+
which contains the `.so` libraries for c++ runtime, and `.jar` for Java API, and required
5+
metadata `AndroidManifest.xml`.
6+
7+
## Core contents
8+
9+
Under `extension/android`,
10+
11+
- `executorch_android/` is the root for the Java `org.pytorch.executorch` package
12+
- `src/`
13+
- `androidTest` contains the android instrumentation test source
14+
- `main` contains the Java source
15+
- `test` contains the Java unit test source
16+
- `build.gradle` is the rule to build the Java package.
17+
- `jni/` contains the JNI layer code, which depends on the ExecuTorch c++ runtime library.
18+
- `CMakeLists.txt` is the rule for building the JNI library.
19+
20+
## Build
21+
22+
`scripts/build_android_library.sh` is a helper script to build the Java library (into .jar), native library (into .so), and the packaged AAR file.
23+
24+
The usage is:
25+
```sh
26+
export ANDROID_HOME=/path/to/sdk
27+
export ANDROID_NDK=/path/to/ndk
28+
sh scripts/build_android_library.sh
29+
```
30+
31+
Please see [Android building from source](https://pytorch.org/executorch/main/using-executorch-android.html#building-from-source) for details
32+
33+
## Test
34+
35+
After the library is built,
36+
37+
```sh
38+
# Run unit test
39+
./gradlew :executorch_android:testDebugUnitTest
40+
41+
# Run instrumentation test
42+
./gradlew :executorch_android:connectedAndroidTest
43+
```

0 commit comments

Comments
 (0)