Skip to content

[Android] build and upload aar #3381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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
3 changes: 2 additions & 1 deletion .ci/docker/common/install_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ install_ubuntu() {
unzip \
gdb \
rsync \
libssl-dev
libssl-dev \
zip

# Cleanup package manager
apt-get autoclean && apt-get clean
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
cp cmake-out-android-arm64-v8a/extension/android/*.so artifacts-to-be-uploaded/arm64-v8a/
cp cmake-out-android-x86_64/lib/*.a artifacts-to-be-uploaded/x86_64/
cp cmake-out-android-x86_64/extension/android/*.so artifacts-to-be-uploaded/x86_64/
# Copyp AAR to S3
cp build_aar/executorch.aar artifacts-to-be-uploaded/
cp build_aar/executorch-llama.aar artifacts-to-be-uploaded/

# Upload the app and its test suite to S3 so that they can be downloaded by the test job
upload-artifacts:
Expand Down
18 changes: 18 additions & 0 deletions build/test_android_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ build_android_native_library() {
pushd examples/demo-apps/android/LlamaDemo
CMAKE_OUT="cmake-out-android-$1" ANDROID_NDK=/opt/ndk ANDROID_ABI="$1" ./gradlew setup
popd
cp "cmake-out-android-$1"/extension/android/*.so build_aar/jni/$1/
}

build_android_demo_app() {
Expand All @@ -37,8 +38,25 @@ build_android_llama_demo_app() {
popd
}

build_aar() {
cp extension/android/build/libs/executorch.jar build_aar/libs
echo \<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" \
package=\"org.pytorch.executorch\"\> \
\<uses-sdk android:minSdkVersion=\"19\" /\> \
\</manifest\> > build_aar/AndroidManifest.xml
pushd build_aar
zip -r executorch.aar libs jni AndroidManifest.xml

rm jni/arm64-v8a/libexecutorch_jni.so jni/x86_64/libexecutorch_jni.so
zip -r executorch-llama.aar libs jni AndroidManifest.xml
popd
}

mkdir -p build_aar/jni/arm64-v8a build_aar/jni/x86_64 build_aar/libs

build_android_native_library arm64-v8a
build_android_native_library x86_64
export_model
build_android_demo_app
build_android_llama_demo_app
build_aar
Loading