From 4d33b6cad9545ddd8abb98967a1f2e0f60484a2f Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 29 Jan 2026 15:27:49 +0000 Subject: [PATCH 1/3] build: android: upgrade docker base img to debian 13 This should make the F-Droid build simpler. ref https://gitlab.com/fdroid/fdroiddata/-/merge_requests/32358#note_3038803195 --- contrib/android/Dockerfile | 9 +++------ contrib/android/apt.sources.list | 4 ++-- contrib/freeze_containers_distro.sh | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile index 57419a479..a7c8d9080 100644 --- a/contrib/android/Dockerfile +++ b/contrib/android/Dockerfile @@ -1,6 +1,6 @@ # based on https://github.com/kivy/python-for-android/blob/master/Dockerfile -FROM debian:bookworm@sha256:d568e251e460295a8743e9d5ef7de673c5a8f9027db11f4e666e96fb5bed708e +FROM debian:trixie@sha256:a3b5f4f0286249a124bfe9845b3aec0f88de32ff31dd8d7e1b945f9f98d116b0 ENV DEBIAN_FRONTEND=noninteractive @@ -94,7 +94,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 --allow-downgrades \ - openjdk-17-jdk-headless \ + openjdk-21-jdk-headless \ && apt -y autoremove RUN yes | ${ANDROID_SDK_MANAGER} --licenses > /dev/null @@ -138,7 +138,6 @@ RUN apt -y update -q \ lbzip2 \ patch \ sudo \ - software-properties-common \ git \ zip \ unzip \ @@ -150,9 +149,7 @@ RUN apt -y update -q \ libtool \ pkg-config \ zlib1g-dev \ - libncurses5-dev \ - libncursesw5-dev \ - libtinfo5 \ + libncurses-dev \ cmake \ libffi-dev \ libssl-dev \ diff --git a/contrib/android/apt.sources.list b/contrib/android/apt.sources.list index b1a8f892b..db248cc0e 100644 --- a/contrib/android/apt.sources.list +++ b/contrib/android/apt.sources.list @@ -1,2 +1,2 @@ -deb https://snapshot.debian.org/archive/debian/20250530T143637Z/ bookworm main -deb-src https://snapshot.debian.org/archive/debian/20250530T143637Z/ bookworm main +deb https://snapshot.debian.org/archive/debian/20260129T082333Z/ trixie main +deb-src https://snapshot.debian.org/archive/debian/20260129T082333Z/ trixie main diff --git a/contrib/freeze_containers_distro.sh b/contrib/freeze_containers_distro.sh index 132f81761..cc19f7de2 100755 --- a/contrib/freeze_containers_distro.sh +++ b/contrib/freeze_containers_distro.sh @@ -7,7 +7,7 @@ set -e DEBIAN_SNAPSHOT_BASE="https://snapshot.debian.org/archive/debian/" DEBIAN_APPIMAGE_DISTRO="bullseye" # should match build-linux/appimage Dockerfile base DEBIAN_WINE_DISTRO="bookworm" # should match build-wine Dockerfile base -DEBIAN_ANDROID_DISTRO="bookworm" # should match android Dockerfile base +DEBIAN_ANDROID_DISTRO="trixie" # should match android Dockerfile base contrib="$(dirname "$0")" From 35ca9b4fff02f43f1c3aa5aa1b5e632c87c8c978 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 29 Jan 2026 17:13:40 +0000 Subject: [PATCH 2/3] build: android: build and use python 3.12 on host, instead of apt 3.13 - want to do the android build on debian 13 (stable) - debian 13 ships python 3.13 in apt - p4a requires Cython < 3.0 - ref https://github.com/kivy/python-for-android/issues/2919 - ref https://github.com/kivy/buildozer/issues/1526 - the newest such Cython is version 0.29.37, which predates python 3.13 - the latest python I managed to build cython 0.29.37 with is 3.12 - upstream p4a really would need some love :( - this is not even just an issue on our p4a fork, but still unsolved upstream - re rebasing our fork: https://github.com/spesmilo/electrum/issues/10331 --- contrib/android/Dockerfile | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile index a7c8d9080..7d643e41b 100644 --- a/contrib/android/Dockerfile +++ b/contrib/android/Dockerfile @@ -129,11 +129,6 @@ RUN curl --location --progress-bar \ # https://github.com/kivy/buildozer/blob/master/docs/source/installation.rst#android-on-ubuntu-2004-64bit RUN apt -y update -q \ && apt -y install -q --no-install-recommends --allow-downgrades \ - python3 \ - python3-dev \ - python3-pip \ - python3-setuptools \ - python3-venv \ wget \ lbzip2 \ patch \ @@ -182,9 +177,29 @@ RUN chown --recursive ${UID} ${WORK_DIR} ${ANDROID_SDK_HOME} RUN chown ${UID} /opt USER ${UID} +# build cpython. FIXME we can't use the python3 from apt, as it is too new o.O +# - p4a and buildozer require cython<3 (see https://github.com/kivy/python-for-android/issues/2919) +# but the last such version, cython 0.29.37, can only be built by up to python 3.12 +ENV VENV_PYTHON_VERSION="3.12.12" +ENV VENV_PY_VER_MAJOR="3.12" +ENV VENV_PYTHON_HASH="487c908ddf4097a1b9ba859f25fe46d22ccaabfb335880faac305ac62bffb79b" +RUN mkdir --parents "/opt/cpython/download" && cd "/opt/cpython/download" \ + && wget "https://www.python.org/ftp/python/${VENV_PYTHON_VERSION}/Python-${VENV_PYTHON_VERSION}.tgz" \ + && echo "${VENV_PYTHON_HASH} Python-${VENV_PYTHON_VERSION}.tgz" | sha256sum -c - \ + && tar xf "Python-${VENV_PYTHON_VERSION}.tgz" -C "/opt/cpython/download" \ + && cd "Python-${VENV_PYTHON_VERSION}" \ + && mkdir "/opt/cpython/install" \ + && ./configure \ + --prefix="/opt/cpython/install" \ + -q \ + && make "-j$(nproc)" -s \ + && make -s altinstall \ + && ln -s "/opt/cpython/install/bin/python${VENV_PY_VER_MAJOR}" "/opt/cpython/install/bin/python3" +RUN "/opt/cpython/install/bin/python3" -m ensurepip + # venv, VIRTUAL_ENV is used by buildozer to indicate a venv environment ENV VIRTUAL_ENV=/opt/venv -RUN python3 -m venv ${VIRTUAL_ENV} +RUN "/opt/cpython/install/bin/python3" -m venv ${VIRTUAL_ENV} ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" COPY contrib/deterministic-build/requirements-build-base.txt /opt/deterministic-build/ From 4da7b7f55d85f11d84cfb5995bd6ad1d9d9cb311 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 30 Jan 2026 16:45:13 +0000 Subject: [PATCH 3/3] build: android: use Java 17, as before debian upgrade :/ When building on debian 12, we were using Java 17. On debian 13, Java 17 is not packaged anymore, instead there is Java 21 and 25. Ideally we should upgrade to Java 21 and just install it from apt. However old Gradle is not compatible with new Java, so we have to upgrade Gradle for that. - see https://docs.gradle.org/current/userguide/compatibility.html Old Gradle is giving build errors with Java 21: ``` Could not compile build file '/home/user/wspace/electrum/.buildozer_qml/android/platform/build-arm64-v8a/dists/Electrum/build.gradle'. > startup failed: General error during conversion: Unsupported class file major version 65 java.lang.IllegalArgumentException: Unsupported class file major version 65 ``` for our p4a fork, I tried to cherry-pick stuff from upstream: - https://github.com/kivy/python-for-android/commit/17bf5322791ec8cec85836fbe906e63664a05445 - https://github.com/kivy/python-for-android/pull/3172 https://github.com/kivy/python-for-android/commit/a8f2ca1c5b1bb6696b47fdf2c052285e116e0ebe - see https://github.com/SomberNight/python-for-android/compare/a01269f7799587ad74ee40e0b642d917b8db7d4e...846a1094874aeb64b623fa746222a41851245271 That seems sufficient to upgrade Gradle as far as p4a is concerned. However that still did not work yet: - contrib/android/make_barcode_scanner.sh fails, as markusfisch/zxing-cpp and markusfisch/CameraView are also using too old gradle versions for Java 21 - it seems they are intentionally doing this to maintain compat with Android 4: see https://github.com/markusfisch/zxing-cpp/commit/d98ed5d0be513c4077b4c13d1f7873f141949839 So for now maybe the path of least resistance is to downgrade to Java 17 :( --- contrib/android/Dockerfile | 39 ++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile index 7d643e41b..d462bd4d2 100644 --- a/contrib/android/Dockerfile +++ b/contrib/android/Dockerfile @@ -91,11 +91,42 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \ && echo '### User Sources for Android SDK Manager' \ > "${ANDROID_SDK_HOME}/.android/repositories.cfg" -# accept Android licenses (JDK necessary!) +# download Java-17 (debian 13 only packages Java-21 and Java-25) +# - we download the amd64 binaries from debian 12 repos +# - we should try to upgrade to Java-21... +# - the main blocker seems to be having to update Gradle (to a version compatible with Java-21) +# - make_barcode_scanner.sh: markusfisch/{zxing-cpp, ...} pins old Gradle +ENV JAVA_JRE_DL_URL="https://snapshot.debian.org/archive/debian/20260130T143028Z/pool/main/o/openjdk-17/openjdk-17-jre-headless_17.0.18+8-1~deb12u1_amd64.deb" +ENV JAVA_JRE_ARCHIVE="openjdk-17-jre-headless.deb" +ENV JAVA_JRE_HASH="5bc36cbb4e383dbea4168d57b5fd9b42375ec8837dd62a1d56677632c3c960e0" +ENV JAVA_JDK_DL_URL="https://snapshot.debian.org/archive/debian/20260130T143028Z/pool/main/o/openjdk-17/openjdk-17-jdk-headless_17.0.18+8-1~deb12u1_amd64.deb" +ENV JAVA_JDK_ARCHIVE="openjdk-17-jdk-headless.deb" +ENV JAVA_JDK_HASH="8841044caa66860a71039342fe3c02b7853b61c518e05970e501faa215b1788a" RUN apt -y update -qq \ - && apt -y install -qq --no-install-recommends --allow-downgrades \ - openjdk-21-jdk-headless \ - && apt -y autoremove + && apt -y install -qq --no-install-recommends \ + ca-certificates-java \ + java-common \ + libcups2 \ + libfontconfig1 \ + liblcms2-2 \ + libjpeg62-turbo \ + libnss3 \ + libasound2 \ + libfreetype6 \ + libharfbuzz0b \ + libpcsclite1 \ + && apt -y autoremove \ + && cd /opt \ + && curl --location --progress-bar "${JAVA_JRE_DL_URL}" --output "${JAVA_JRE_ARCHIVE}" \ + && echo "${JAVA_JRE_HASH} ${JAVA_JRE_ARCHIVE}" | sha256sum -c - \ + && dpkg -i "${JAVA_JRE_ARCHIVE}" \ + && rm "${JAVA_JRE_ARCHIVE}" \ + && curl --location --progress-bar "${JAVA_JDK_DL_URL}" --output "${JAVA_JDK_ARCHIVE}" \ + && echo "${JAVA_JDK_HASH} ${JAVA_JDK_ARCHIVE}" | sha256sum -c - \ + && dpkg -i "${JAVA_JDK_ARCHIVE}" \ + && rm "${JAVA_JDK_ARCHIVE}" + +# accept Android licenses (JDK necessary!) RUN yes | ${ANDROID_SDK_MANAGER} --licenses > /dev/null