Using Python for Android and QPython
Instant App
Do you want to teach your Android device some clever tricks without mastering the art of native app development? Install Python, and you can automate practically any task and write complete apps using this popular scripting language.
To make it easier to run various scripting languages on the Android platform, Google created the Scripting Layer for Android (SL4A) project [1]. Although Google at some point has lost interest in maintaining the project, the last release of the framework runs perfectly well on any Android version before 5.0. The Python for Android component includes Python 2.6, so practically any script compatible with this version of Python will work on Android. More importantly, the combination of the scripting layer and Python for Android can be used to access Android APIs, so you can write Python scripts that offer the same functionality as native Android apps.
That's all fine and dandy, but it looks like the SL4A project is no longer maintained, and the available APK packages don't run well on Android 5.0 and higher. Thankfully, the project's code is released under the Apache License 2.0, so the SL4A [2] and Python for Android [3] parts have already been forked and updated to work with Android 5.0.
The SL4A and Python for Android pair is not the only option for using Python for Android. The QPython project [4] aims to build an entire Python environment for the Android platform (Figure 1). QPython is available in Google Play Store in two editions: QPython is based on the Python 2.x series [5], and QPython3 comes with Python 3.x [6]. Both versions are packed with useful features. What's more, QPython supports SL4A, so it provides a drop-in replacement for Google's Scripting Layer for Android and Python for Android. The environment comes with the PIP package manager, which allows you to add practically any Python library and module to your project.
[...]
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

News
-
TuxCare Announces Support for AlmaLinux 9.2
Thanks to TuxCare, AlmaLinux 9.2 (and soon version 9.6) now enjoys years of ongoing patching and compliance.
-
Go-Based Botnet Attacking IoT Devices
Using an SSH credential brute-force attack, the Go-based PumaBot is exploiting IoT devices everywhere.
-
Plasma 6.5 Promises Better Memory Optimization
With the stable Plasma 6.4 on the horizon, KDE has a few new tricks up its sleeve for Plasma 6.5.
-
KaOS 2025.05 Officially Qt5 Free
If you're a fan of independent Linux distributions, the team behind KaOS is proud to announce the latest iteration that includes kernel 6.14 and KDE's Plasma 6.3.5.
-
Linux Kernel 6.15 Now Available
The latest Linux kernel is now available with several new features/improvements and the usual bug fixes.
-
Microsoft Makes Surprising WSL Announcement
In a move that might surprise some users, Microsoft has made Windows Subsystem for Linux open source.
-
Red Hat Releases RHEL 10 Early
Red Hat quietly rolled out the official release of RHEL 10.0 a bit early.
-
openSUSE Joins End of 10
openSUSE has decided to not only join the End of 10 movement but it also will no longer support the Deepin Desktop Environment.
-
New Version of Flatpak Released
Flatpak 1.16.1 is now available as the latest, stable version with various improvements.
-
IBM Announces Powerhouse Linux Server
IBM has unleashed a seriously powerful Linux server with the LinuxONE Emperor 5.