Skip to content

Commit

Permalink
android build: bump targetSdkVersion from 30 to 31
Browse files Browse the repository at this point in the history
The google play store will require 31, starting 2022-11 (next month).
A few commits are cherry-picked onto our forks of p4a and buildozer
from upstream, but the forks are not rebased.

Note that the compileSdkVersion is kept at 30,
only the targetSdkVersion is bumped 30->31.

closes #8010

I am trying to upstream some relevant p4a and buildozer changes
in e.g. kivy/python-for-android#2686
  • Loading branch information
SomberNight committed Oct 14, 2022
1 parent 1789778 commit 0efc881
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
9 changes: 4 additions & 5 deletions contrib/android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ENV ANDROID_SDK_BUILD_TOOLS_VERSION="30.0.3"
ENV ANDROID_SDK_HASH="d71f75333d79c9c6ef5c39d3456c6c58c613de30e6a751ea0dbd433e8f8b9cbf"
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_SDK_MANAGER="${ANDROID_SDK_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_HOME}"

# download and install Android SDK
RUN curl --location --progress-bar \
Expand All @@ -64,7 +64,6 @@ RUN curl --location --progress-bar \
&& echo "${ANDROID_SDK_HASH} ${ANDROID_SDK_TOOLS_ARCHIVE}" | sha256sum -c - \
&& 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" \
&& rm -rf "${ANDROID_SDK_TOOLS_ARCHIVE}"

# update Android SDK, install Android API, Build Tools...
Expand All @@ -83,7 +82,7 @@ RUN yes | ${ANDROID_SDK_MANAGER} --licenses > /dev/null
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"
chmod +x "${ANDROID_SDK_HOME}/cmdline-tools/bin/avdmanager"

# download ANT
ENV APACHE_ANT_VERSION="1.9.4"
Expand Down Expand Up @@ -166,7 +165,7 @@ RUN cd /opt \
&& git remote add sombernight https://github.com/SomberNight/buildozer \
&& git fetch --all \
# commit: from branch sombernight/electrum_20210421
&& git checkout "d570116e88184b0eca0c6b59a25edd49d977da23^{commit}" \
&& git checkout "6f03256e8312f8d1e5a6da3a2a1bf06e2738325e^{commit}" \
&& python3 -m pip install --no-build-isolation --no-dependencies --user -e .

# install python-for-android
Expand All @@ -177,7 +176,7 @@ RUN cd /opt \
&& git remote add accumulator https://github.com/accumulator/python-for-android \
&& git fetch --all \
# commit: from branch sombernight/electrum_20210421d
&& git checkout "4535a333f9928e894caedefc4f746f9c6a0dc50f^{commit}" \
&& git checkout "1187e179aed6fddb19bf026274ff69903d3b04b2^{commit}" \
&& python3 -m pip install --no-build-isolation --no-dependencies --user -e .

# build env vars
Expand Down
9 changes: 8 additions & 1 deletion contrib/android/buildozer_kivy.spec
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ fullscreen = False
# (list) Permissions
android.permissions = INTERNET, CAMERA, WRITE_EXTERNAL_STORAGE

# (int) Android API to use (targetSdkVersion AND compileSdkVersion)
# (int) Android API to use (compileSdkVersion)
# note: when changing, Dockerfile also needs to be changed to install corresponding build tools
android.api = 30

# (int) Android targetSdkVersion
android.target_sdk_version = 31

# (int) Minimum API required. You will need to set the android.ndk_api to be as low as this value.
android.minapi = 21

Expand Down Expand Up @@ -157,6 +160,10 @@ android.manifest.launch_mode = singleTask
# note: can be overwritten by APP_ANDROID_ARCH env var
#android.arch = armeabi-v7a

# (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
# android.numeric_version = 1

# (list) Android application meta-data to set (key=value format)
#android.meta_data =

Expand Down
9 changes: 8 additions & 1 deletion contrib/android/buildozer_qml.spec
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ fullscreen = False
# (list) Permissions
android.permissions = INTERNET, CAMERA, WRITE_EXTERNAL_STORAGE

# (int) Android API to use (targetSdkVersion AND compileSdkVersion)
# (int) Android API to use (compileSdkVersion)
# note: when changing, Dockerfile also needs to be changed to install corresponding build tools
android.api = 30

# (int) Android targetSdkVersion
android.target_sdk_version = 31

# (int) Minimum API required. You will need to set the android.ndk_api to be as low as this value.
android.minapi = 21

Expand Down Expand Up @@ -169,6 +172,10 @@ android.manifest.launch_mode = singleTask
# note: can be overwritten by APP_ANDROID_ARCH env var
#android.arch = armeabi-v7a

# (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
# android.numeric_version = 1

# (list) Android application meta-data to set (key=value format)
#android.meta_data =

Expand Down

0 comments on commit 0efc881

Please sign in to comment.