Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 436d5a9

Browse files
authored
Update prerequisites (Dockerfile, prerequisites.py, docs) (#2923)
* Update Dockerfile to reflect latest requirements * Increase JDK version on macOS prerequisites * Force usage of a specific JDK version on macOS * Update docs to reflect the current status * Re-order deps in quickstart and Dockerfile
1 parent 83e74ca commit 436d5a9

File tree

3 files changed

+70
-79
lines changed
  • Dockerfile
  • doc/source
    • quickstart.rst
  • pythonforandroid
    • prerequisites.py

3 files changed

+70
-79
lines changed

Dockerfile

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# If platform is not specified, by default the target platform of the build request is used.
1919
# This is not what we want, as Google doesn't provide a linux/arm64 compatible NDK.
2020
# See: https://docs.docker.com/engine/reference/builder/#from
21-
FROM --platform=linux/amd64 ubuntu:20.04
21+
FROM --platform=linux/amd64 ubuntu:22.04
2222

2323
# configure locale
2424
RUN apt -y update -qq > /dev/null \
@@ -48,43 +48,37 @@ ENV HOME_DIR="/home/${USER}"
4848
ENV WORK_DIR="${HOME_DIR}/app" \
4949
PATH="${HOME_DIR}/.local/bin:${PATH}" \
5050
ANDROID_HOME="${HOME_DIR}/.android" \
51-
JAVA_HOME="/usr/lib/jvm/java-13-openjdk-amd64"
51+
JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
5252

5353

5454
# install system dependencies
55-
RUN dpkg --add-architecture i386 \
56-
&& ${RETRY} apt -y update -qq > /dev/null \
55+
RUN ${RETRY} apt -y update -qq > /dev/null \
5756
&& ${RETRY} DEBIAN_FRONTEND=noninteractive apt install -qq --yes --no-install-recommends \
58-
autoconf \
59-
automake \
60-
autopoint \
61-
build-essential \
62-
ccache \
63-
cmake \
64-
gettext \
65-
git \
66-
lbzip2 \
67-
libffi-dev \
68-
libgtk2.0-0:i386 \
69-
libidn11:i386 \
70-
libltdl-dev \
71-
libncurses5:i386 \
72-
libssl-dev \
73-
libstdc++6:i386 \
74-
libtool \
75-
openjdk-13-jdk \
76-
patch \
77-
pkg-config \
78-
python3 \
79-
python3-dev \
80-
python3-pip \
81-
python3-venv \
82-
sudo \
83-
unzip \
84-
wget \
85-
zip \
86-
zlib1g-dev \
87-
zlib1g:i386 \
57+
ant \
58+
autoconf \
59+
automake \
60+
ccache \
61+
cmake \
62+
g++ \
63+
gcc \
64+
git \
65+
lbzip2 \
66+
libffi-dev \
67+
libltdl-dev \
68+
libtool \
69+
libssl-dev \
70+
make \
71+
openjdk-17-jdk \
72+
patch \
73+
pkg-config \
74+
python3 \
75+
python3-dev \
76+
python3-pip \
77+
python3-venv \
78+
sudo \
79+
unzip \
80+
wget \
81+
zip \
8882
&& apt -y autoremove \
8983
&& apt -y clean \
9084
&& rm -rf /var/lib/apt/lists/*

doc/source/quickstart.rst

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -56,48 +56,45 @@ You can also test the master branch from Github using::
5656

5757
pip install git+https://github.com/kivy/python-for-android.git
5858

59-
Installing Dependencies
59+
Installing Prerequisites
6060
~~~~~~~~~~~~~~~~~~~~~~~
6161

62-
p4a has several dependencies that must be installed:
63-
64-
- ant
65-
- autoconf (for libffi and other recipes)
66-
- automake
67-
- ccache (optional)
68-
- cmake (required for some native code recipes like jpeg's recipe)
69-
- cython (can be installed via pip)
70-
- gcc
71-
- git
72-
- libncurses (including 32 bit)
73-
- libtool (for libffi and recipes)
74-
- libssl-dev (for TLS/SSL support on hostpython3 and recipe)
75-
- openjdk-8
76-
- patch
77-
- python3
78-
- unzip
79-
- virtualenv (can be installed via pip)
80-
- zlib (including 32 bit)
81-
- zip
82-
83-
On recent versions of Ubuntu and its derivatives you may be able to
84-
install most of these with::
85-
86-
sudo dpkg --add-architecture i386
87-
sudo apt-get update
88-
sudo apt-get install -y build-essential ccache git zlib1g-dev python3 python3-dev libncurses5:i386 libstdc++6:i386 zlib1g:i386 openjdk-8-jdk unzip ant ccache autoconf libtool libssl-dev
89-
90-
On Arch Linux you should be able to run the following to
91-
install most of the dependencies (note: this list may not be
92-
complete)::
62+
p4a requires a few dependencies to be installed on your system to work
63+
properly. While we're working on a way to automate pre-requisites checks,
64+
suggestions and installation on all platforms (macOS is already supported),
65+
on Linux distros you'll need to install them manually.
9366

94-
sudo pacman -S core/autoconf core/automake core/gcc core/make core/patch core/pkgconf extra/cmake extra/jdk8-openjdk extra/python-pip extra/unzip extra/zip
67+
On recent versions of Ubuntu and its derivatives you can easily install them via
68+
the following command (re-adapted from the `Dockerfile` we use to perform CI builds)::
9569

96-
On macOS::
70+
sudo apt-get update
71+
sudo apt-get install -y \
72+
ant \
73+
autoconf \
74+
automake \
75+
ccache \
76+
cmake \
77+
g++ \
78+
gcc \
79+
git \
80+
lbzip2 \
81+
libffi-dev \
82+
libltdl-dev \
83+
libtool \
84+
libssl-dev \
85+
make \
86+
openjdk-17-jdk \
87+
patch \
88+
pkg-config \
89+
python3 \
90+
python3-dev \
91+
python3-pip \
92+
python3-venv \
93+
sudo \
94+
unzip \
95+
wget \
96+
zip
9797

98-
brew install autoconf automake libtool openssl pkg-config
99-
brew tap homebrew/cask-versions
100-
brew install --cask homebrew/cask-versions/adoptopenjdk8
10198

10299
Installing Android SDK
103100
~~~~~~~~~~~~~~~~~~~~~~

pythonforandroid/prerequisites.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class JDKPrerequisite(Prerequisite):
151151
name = "JDK"
152152
mandatory = dict(linux=False, darwin=True)
153153
installer_is_supported = dict(linux=False, darwin=True)
154-
min_supported_version = 11
154+
supported_version = 17
155155

156156
def darwin_checker(self):
157157
if "JAVA_HOME" in os.environ:
@@ -197,21 +197,21 @@ def _darwin_jdk_is_supported(self, jdk_path):
197197
res = _stdout_res.strip().decode()
198198

199199
major_version = int(res.split(" ")[-1].split(".")[0])
200-
if major_version >= self.min_supported_version:
200+
if major_version == self.supported_version:
201201
info(f"Found a valid JDK at {jdk_path}")
202202
return True
203203
else:
204-
error(f"JDK {self.min_supported_version} or higher is required")
204+
error(f"JDK version {major_version} is not supported")
205205
return False
206206

207207
def darwin_helper(self):
208208
info(
209-
"python-for-android requires a JDK 11 or higher to be installed on macOS,"
209+
f"python-for-android requires a JDK {self.supported_version} to be installed on macOS,"
210210
"but seems like you don't have one installed."
211211
)
212212
info(
213213
"If you think that a valid JDK is already installed, please verify that "
214-
"you have a JDK 11 or higher installed and that `/usr/libexec/java_home` "
214+
f"you have a JDK {self.supported_version} installed and that `/usr/libexec/java_home` "
215215
"shows the correct path."
216216
)
217217
info(
@@ -221,12 +221,12 @@ def darwin_helper(self):
221221

222222
def darwin_installer(self):
223223
info(
224-
"Looking for a JDK 11 or higher installation which is not the default one ..."
224+
f"Looking for a JDK {self.supported_version} installation which is not the default one ..."
225225
)
226-
jdk_path = self._darwin_get_libexec_jdk_path(version="11+")
226+
jdk_path = self._darwin_get_libexec_jdk_path(version=str(self.supported_version))
227227

228228
if not self._darwin_jdk_is_supported(jdk_path):
229-
info("We're unlucky, there's no JDK 11 or higher installation available")
229+
info(f"We're unlucky, there's no JDK {self.supported_version} or higher installation available")
230230

231231
base_url = "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/"
232232
if platform.machine() == "arm64":

0 commit comments

Comments
(0)