File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments