From f6538a3473bb91a8905d10cb0b0502d16acc5cba Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sat, 27 Jan 2024 01:08:47 +0200 Subject: [PATCH 1/4] Set NDK as recommended by buildozer, update also SDK tools versions --- .buildbot/android/Dockerfile | 6 +++--- packages/android/buildozer.spec | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.buildbot/android/Dockerfile b/.buildbot/android/Dockerfile index 83ea3b66..11953fc0 100755 --- a/.buildbot/android/Dockerfile +++ b/.buildbot/android/Dockerfile @@ -18,7 +18,7 @@ RUN apt -y update -qq \ ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk" -ENV ANDROID_NDK_VERSION="23b" +ENV ANDROID_NDK_VERSION="25b" ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" # get the latest version from https://developer.android.com/ndk/downloads/index.html @@ -35,8 +35,8 @@ RUN curl "${ANDROID_NDK_DL_URL}" \ ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk" # get the latest version from https://developer.android.com/studio/index.html -ENV ANDROID_SDK_TOOLS_VERSION="8092744" -ENV ANDROID_SDK_BUILD_TOOLS_VERSION="30.0.3" +ENV ANDROID_SDK_TOOLS_VERSION="11076708" +ENV ANDROID_SDK_BUILD_TOOLS_VERSION="34.0.0" ENV ANDROID_SDK_TOOLS_ARCHIVE="commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip" ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}" ENV ANDROID_SDK_MANAGER="${ANDROID_SDK_HOME}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_HOME}" diff --git a/packages/android/buildozer.spec b/packages/android/buildozer.spec index 5e4ad2b3..1cd7478a 100644 --- a/packages/android/buildozer.spec +++ b/packages/android/buildozer.spec @@ -98,7 +98,7 @@ android.api = 28 android.minapi = 21 # (str) Android NDK version to use -android.ndk = 23b +android.ndk = 25b # (int) Android NDK API to use (optional). This is the minimum API your app will support. android.ndk_api = 21 @@ -354,4 +354,4 @@ warn_on_root = 1 # # Then, invoke the command line with the "demo" profile: # -#buildozer --profile demo android debug \ No newline at end of file +#buildozer --profile demo android debug -- 2.45.1 From d564445c4ed9c912c060383e0bac78eb67c2c8d5 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sat, 27 Jan 2024 02:07:40 +0200 Subject: [PATCH 2/4] Upgrade to focal and openjdk-17-jdk-headless --- .buildbot/android/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.buildbot/android/Dockerfile b/.buildbot/android/Dockerfile index 11953fc0..66d350d7 100755 --- a/.buildbot/android/Dockerfile +++ b/.buildbot/android/Dockerfile @@ -1,7 +1,6 @@ # A container for buildbot -FROM ubuntu:bionic AS android -# FROM ubuntu:20.04 AS buildbot-bionic +FROM ubuntu:focal AS android ENV ANDROID_HOME="/opt/android" @@ -57,7 +56,7 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \ # accept Android licenses (JDK necessary!) RUN apt -y update -qq \ && apt -y install -qq --no-install-recommends \ - openjdk-11-jdk-headless \ + openjdk-17-jdk-headless \ && apt -y autoremove RUN yes | ${ANDROID_SDK_MANAGER} --licenses > /dev/null -- 2.45.1 From 43ad5f38f88255e9be3f185b6c5dbba7a3fb391b Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sun, 28 Jan 2024 00:34:04 +0200 Subject: [PATCH 3/4] Rewritten the Dockerfile: - install all the deb packages by apt-get in one place in the beginning, - a separate command for jdk; - pip packages are also before the SDK, request latest versions; - added commands for the local build. --- .buildbot/android/Dockerfile | 114 +++++++++++++++-------------------- 1 file changed, 47 insertions(+), 67 deletions(-) diff --git a/.buildbot/android/Dockerfile b/.buildbot/android/Dockerfile index 66d350d7..c649373a 100755 --- a/.buildbot/android/Dockerfile +++ b/.buildbot/android/Dockerfile @@ -1,19 +1,28 @@ - # A container for buildbot + FROM ubuntu:focal AS android +ENV DEBIAN_FRONTEND=noninteractive ENV ANDROID_HOME="/opt/android" -RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \ - locales && \ - locale-gen en_US.UTF-8 +RUN apt-get update -qq > /dev/null \ + && apt-get -y install -qq --no-install-recommends locales \ + && locale-gen en_US.UTF-8 ENV LANG="en_US.UTF-8" \ LANGUAGE="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" - -RUN apt -y update -qq \ - && apt -y install -qq --no-install-recommends curl unzip ca-certificates \ - && apt -y autoremove + +# install system/build dependencies +RUN apt-get -y update -qq \ + && apt-get -y install -qq --no-install-recommends \ + curl autoconf automake build-essential cmake git nano libtool \ + libltdl-dev libffi-dev libssl-dev \ + patch pkg-config python-is-python3 python3-dev python3-pip unzip zip + +RUN apt-get -y install -qq --no-install-recommends openjdk-17-jdk \ + && apt-get -y autoremove + +RUN pip install pip install buildozer cython virtualenv ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk" @@ -24,9 +33,8 @@ ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux.zip" ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}" # download and install Android NDK -RUN curl "${ANDROID_NDK_DL_URL}" \ - --output "${ANDROID_NDK_ARCHIVE}" \ - && mkdir --parents "${ANDROID_NDK_HOME_V}" \ +RUN curl "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE}" \ + && mkdir -p "${ANDROID_NDK_HOME_V}" \ && unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" \ && ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}" \ && rm -rf "${ANDROID_NDK_ARCHIVE}" @@ -36,35 +44,38 @@ ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk" # get the latest version from https://developer.android.com/studio/index.html ENV ANDROID_SDK_TOOLS_VERSION="11076708" ENV ANDROID_SDK_BUILD_TOOLS_VERSION="34.0.0" +ENV ANDROID_SDK_CMDLINE_TOOLS_VERSION="12.0" ENV ANDROID_SDK_TOOLS_ARCHIVE="commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip" ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}" -ENV ANDROID_SDK_MANAGER="${ANDROID_SDK_HOME}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_HOME}" +ENV ANDROID_CMDLINE_TOOLS_DIR="${ANDROID_SDK_HOME}/cmdline-tools/${ANDROID_SDK_CMDLINE_TOOLS_VERSION}" +ENV ANDROID_SDK_MANAGER="${ANDROID_CMDLINE_TOOLS_DIR}/bin/sdkmanager --sdk_root=${ANDROID_SDK_HOME}" # download and install Android SDK -RUN curl "${ANDROID_SDK_TOOLS_DL_URL}" \ - --output "${ANDROID_SDK_TOOLS_ARCHIVE}" \ - && mkdir --parents "${ANDROID_SDK_HOME}" \ - && unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" -d "${ANDROID_SDK_HOME}" \ - && mv "${ANDROID_SDK_HOME}/cmdline-tools" "${ANDROID_SDK_HOME}/tools" \ +RUN curl "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" \ + && mkdir -p "${ANDROID_SDK_HOME}/cmdline-tools" \ + && unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" \ + -d "${ANDROID_SDK_HOME}/cmdline-tools" \ + && mv "${ANDROID_SDK_HOME}/cmdline-tools/cmdline-tools" \ + ${ANDROID_CMDLINE_TOOLS_DIR} \ + && ln -sfn ${ANDROID_CMDLINE_TOOLS_DIR} "${ANDROID_SDK_HOME}/tools" \ && rm -rf "${ANDROID_SDK_TOOLS_ARCHIVE}" # update Android SDK, install Android API, Build Tools... -RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \ +RUN mkdir -p "${ANDROID_SDK_HOME}/.android/" \ && echo '### User Sources for Android SDK Manager' \ > "${ANDROID_SDK_HOME}/.android/repositories.cfg" # accept Android licenses (JDK necessary!) -RUN apt -y update -qq \ - && apt -y install -qq --no-install-recommends \ - openjdk-17-jdk-headless \ - && apt -y autoremove RUN yes | ${ANDROID_SDK_MANAGER} --licenses > /dev/null # download platforms, API, build tools -RUN ${ANDROID_SDK_MANAGER} "platforms;android-30" > /dev/null && \ - ${ANDROID_SDK_MANAGER} "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null && \ - ${ANDROID_SDK_MANAGER} "extras;android;m2repository" > /dev/null && \ - chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager" +RUN ${ANDROID_SDK_MANAGER} "platforms;android-30" > /dev/null \ + && ${ANDROID_SDK_MANAGER} "platforms;android-28" > /dev/null \ + && ${ANDROID_SDK_MANAGER} "platform-tools" > /dev/null \ + && ${ANDROID_SDK_MANAGER} "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" \ + > /dev/null \ + && ${ANDROID_SDK_MANAGER} "extras;android;m2repository" > /dev/null \ + && chmod +x "${ANDROID_CMDLINE_TOOLS_DIR}/bin/avdmanager" # download ANT ENV APACHE_ANT_VERSION="1.9.4" @@ -73,50 +84,19 @@ ENV APACHE_ANT_DL_URL="https://archive.apache.org/dist/ant/binaries/${APACHE_ANT ENV APACHE_ANT_HOME="${ANDROID_HOME}/apache-ant" ENV APACHE_ANT_HOME_V="${APACHE_ANT_HOME}-${APACHE_ANT_VERSION}" -RUN curl "${APACHE_ANT_DL_URL}" \ - --output "${APACHE_ANT_ARCHIVE}" \ +RUN curl "${APACHE_ANT_DL_URL}" --output "${APACHE_ANT_ARCHIVE}" \ && tar -xf "${APACHE_ANT_ARCHIVE}" -C "${ANDROID_HOME}" \ && ln -sfn "${APACHE_ANT_HOME_V}" "${APACHE_ANT_HOME}" \ && rm -rf "${APACHE_ANT_ARCHIVE}" -# install system/build dependencies -RUN apt -y update -qq \ - && apt -y install -qq --no-install-recommends \ - python3 \ - python3-dev \ - python3-pip \ - python3-setuptools \ - python3-venv \ - wget \ - lbzip2 \ - bzip2 \ - lzma \ - patch \ - sudo \ - software-properties-common \ - git \ - zip \ - unzip \ - build-essential \ - ccache \ - autoconf \ - libtool \ - pkg-config \ - zlib1g-dev \ - libncurses5-dev \ - libncursesw5-dev \ - libtinfo5 \ - cmake \ - libffi-dev \ - libssl-dev \ - automake \ - gettext \ - libltdl-dev \ - libidn11 \ - && apt -y autoremove \ - && apt -y clean -# INSTALL ANDROID PACKAGES +RUN useradd -m -U builder && mkdir /android -RUN pip3 install buildozer==1.4.0 -RUN pip3 install --upgrade cython==0.29.15 \ No newline at end of file +WORKDIR /android + +RUN chown -R builder.builder /android "${ANDROID_SDK_HOME}/.android" \ + && chmod -R go+w "${ANDROID_SDK_HOME}/.android" + +USER builder + +ADD . . -- 2.45.1 From f88ffccfb0a5ea5193853b55042b6e35623d9852 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Wed, 31 Jan 2024 18:38:07 +0200 Subject: [PATCH 4/4] Remove x86 arch --- packages/android/buildozer.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/android/buildozer.spec b/packages/android/buildozer.spec index 1cd7478a..e560934f 100644 --- a/packages/android/buildozer.spec +++ b/packages/android/buildozer.spec @@ -225,7 +225,7 @@ android.ant_path = /opt/android/apache-ant #android.copy_libs = 1 # (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64 -android.archs = armeabi-v7a, arm64-v8a, x86, x86_64 +android.archs = armeabi-v7a, arm64-v8a, x86_64 # (int) overrides automatic versionCode computation (used in build.gradle) # this is not the same as app version and should only be edited if you know what you're doing -- 2.45.1