Skip to content

Commit

Permalink
Attempt to fix Android build
Browse files Browse the repository at this point in the history
  • Loading branch information
Tombana committed Jun 16, 2024
1 parent 177ccba commit 76ef9b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: ./third_party/install_android.sh
- name: Configure Bazel
run: LCE_SET_ANDROID_WORKSPACE=1 ANDROID_SDK_HOME="/tmp/lce_android" ANDROID_NDK_HOME="/tmp/lce_android/ndk/21.4.7075529" ./configure.py
run: LCE_SET_ANDROID_WORKSPACE=1 ANDROID_SDK_HOME="/tmp/lce_android" ANDROID_SDK_API_LEVEL=30 ANDROID_NDK_HOME="/tmp/lce_android/ndk/25.2.9519653" ANDROID_NDK_API_LEVEL=30 ./configure.py
shell: bash
- name: Build LCE AAR
run: BUILDER=bazelisk ./larq_compute_engine/tflite/java/build_lce_aar.sh
27 changes: 17 additions & 10 deletions third_party/install_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ set -e
# **NOTE**: This requires Java 8 and won't work on never versions. See:
# https://stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a

# Taken from tensorflow/lite/tools/tflite-android.Dockerfile

# default LCE Android Env. variables
export ANDROID_SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip"
export ANDROID_SDK_URL="https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip"
export ANDROID_HOME="/tmp/lce_android"
export ANDROID_VERSION=29
export ANDROID_BUILD_TOOLS_VERSION=30.0.2
export ANDROID_NDK_VERSION=21.4.7075529
export ANDROID_API_LEVEL=30
export ANDROID_BUILD_TOOLS_VERSION=31.0.0
export ANDROID_NDK_VERSION=25.2.9519653
export ANDROID_NDK_API_LEVEL=30


# download android SDK
mkdir -p $ANDROID_HOME; cd $ANDROID_HOME;
Expand All @@ -19,24 +23,27 @@ curl -o lce_android_sdk.zip $ANDROID_SDK_URL;
echo -e "DONE.\n\n"

echo -e "Unpacking Android SDK ... "
unzip lce_android_sdk.zip;
unzip lce_android_sdk.zip -d /tmp
mkdir -p ${ANDROID_HOME}/cmdline-tools
mv /tmp/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest
echo -e "DONE.\n\n"

rm lce_android_sdk.zip;

# install android platform and build tools
echo -e "Updating SDK manager ... "
yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
$ANDROID_HOME/tools/bin/sdkmanager --update
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --update
echo -e "DONE.\n\n"

echo -e "Installing Android SDK Platform and Build Tools ... "
$ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
"platforms;android-${ANDROID_VERSION}" \
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \
"build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
"platforms;android-${ANDROID_API_LEVEL}" \
"platform-tools"
echo -e "DONE.\n\n"

echo -e "Installing Android NDK ... "
$ANDROID_HOME/tools/bin/sdkmanager \
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \
"ndk;${ANDROID_NDK_VERSION}"
echo -e "DONE.\n\n"

0 comments on commit 76ef9b6

Please sign in to comment.