Skip to content

Commit

Permalink
Update android container and support gradle rust plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun authored and Rawa committed Dec 17, 2024
1 parent 8f1cf96 commit 41dca10
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions android/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ ARG COMMAND_LINE_TOOLS_VERSION=11076708 \
COMMAND_LINE_TOOLS_SHA256_CHECKSUM=2d2d50857e4eb553af5a6dc3ad507a17adf43d115264b1afc116f95c92e5e258

# NDK and checksum from: https://github.com/android/ndk/wiki#supported-downloads
ARG NDK_VERSION=r27b \
NDK_SHA1_CHECKSUM=6fc476b2e57d7c01ac0c95817746b927035b9749 \
MIN_SDK_VERSION=26
ARG NDK_VERSION_NAME=r27c \
NDK_SHA1_CHECKSUM=090e8083a715fdb1a3e402d0763c388abb03fb4e \
MIN_SDK_VERSION=26 \
NDK_VERSION=27.2.12479018

ENV ANDROID_SDK_ROOT=/opt/android
# ANDROID_HOME is kept for backwards compatibility
ENV ANDROID_HOME=$ANDROID_SDK_ROOT
ENV ANDROID_NDK_HOME=${ANDROID_SDK_ROOT}/android-ndk-${NDK_VERSION}
ENV ANDROID_NDK_HOME=${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION}
ENV NDK_TOOLCHAIN_DIR=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin
ENV GRADLE_USER_HOME=/root/.gradle

Expand All @@ -67,6 +68,9 @@ ENV AR_x86_64_linux_android=${NDK_TOOLCHAIN_DIR}/llvm-ar \
CC_x86_64_linux_android=${NDK_TOOLCHAIN_DIR}/x86_64-linux-android${MIN_SDK_VERSION}-clang \
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=${NDK_TOOLCHAIN_DIR}/x86_64-linux-android${MIN_SDK_VERSION}-clang

# Set up python3 path for the rust gradle plugin
ENV RUST_ANDROID_GRADLE_PYTHON_COMMAND=/usr/bin/python3

# === Install/set up the image ===

RUN apt-get update -y && apt-get install -y \
Expand Down Expand Up @@ -97,9 +101,11 @@ RUN curl -sfLo /tmp/cmdline-tools.zip https://dl.google.com/android/repository/c
RUN yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager $SDK_VERSION $BUILD_TOOLS_VERSION "platform-tools"

# Install Android NDK
RUN curl -sfLo /tmp/ndk.zip https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux.zip && \
RUN mkdir -p ${ANDROID_SDK_ROOT}/ndk && \
curl -sfLo /tmp/ndk.zip https://dl.google.com/android/repository/android-ndk-${NDK_VERSION_NAME}-linux.zip && \
echo "$NDK_SHA1_CHECKSUM /tmp/ndk.zip" | sha1sum -c && \
unzip -q /tmp/ndk.zip -d $ANDROID_SDK_ROOT && \
unzip -q /tmp/ndk.zip -d /tmp && \
mv /tmp/android-ndk-${NDK_VERSION_NAME} ${ANDROID_NDK_HOME} && \
rm /tmp/ndk.zip

# Apply go patch required for Android
Expand Down

0 comments on commit 41dca10

Please sign in to comment.