Deploying your Python application to Android
Shyamnath Premnadh
Hi, there ๐
Shyamnath Premnadh aka Shyam
Qt for Python
Senior Software Engineer @ TQtc
Why is Android an important platform ?๐ฆพ
Is Python a good alternative for Java/Kotlin for Android development? ๐ค
Currently, NO
Python ๐ซ Android
- No official support for Android in CPython
- No native support for Python with Android SDK
- The app should bundle the Python binaries
Python โค๏ธ Android
- No official support for Android in CPython -
PEP 738: Adding Android as a supported platform - Malcolmn Smith
- No native support for Python with Android SDK
- The app should bundle the Python binaries
GUI frameworks with Android support
- Kivy
- Flet
- PySide6
- PyQt6
- Toga
GUI frameworks with Android support
-
Kivy
-
Flet
-
PySide6
- PyQt6
- Toga
Contact Manager Application๐ฑ
Flet
- Since 2023
- Server-Driven UI framework based on Flutter
- Minimal API - Fully in Python
- Deploying as a web app on the browser or a progressive web app (PWA)
Contact Manager Application - Flet
Pros and Cons - Flet
Pros
- More modern UI
- Easy to get started with
- Fully in Python
- Minimal API, but hightly customizable
- Cross-platform + WebAssembly
- Active and responsive community
Cons
- Still very new
- Limited resources online
- No visual designer
- No hardware access
- Not as mature as PySide6 and Kivy
- No localization
Kivy
- Since 2012
- Two ways to create GUI
- More suited for games than traditional applications
- KivyMD for Material Design
Contact Manager Application - Kivy
Pros and Cons - Kivy
Pros
- Visual Designer - KivyMDBuilder
- kv language is easy to learn
- Both PySide6 and Flet uses `buildozer`
- More modules than Flet
- Active community
Cons
- Need to learn a new language
- Not as modern as Flet even with KivyMD
- Not as mature as Qt
- Not ideal for Desktop platforms
- Limited resources as compared to PySide6
- Incomplete API reference
- Confusing Widget names. eg. Accordion
PySide6
- Official bindings for the Qt framework (since 1995 ๐ฎ)
-
Two ways to create GUIs
- Qt Widgets - Python and C++
- Qt Quick (Material Design) - QML and Python/C++
- Visual Designers
- Qt Widgets - Qt Designer
- Qt Quick - Qt Design Studio
Contact Manager Application - PySide
Pros and Cons - PySide6
Pros
- More features and modules than Kivy and Flet
- Lot of resources
- Big and active community
- Easy switch to C++ - high performance
- Lot of tools eg: Qt Designer, Qt Design Studio etc
Cons
- Need to learn a new language
- Steep learning curve
- Needs to manually create Android wheels
- No iOS and WebAssembly support
- Needs a Unix host system
Python Packages Support ๐ฆ
Pure Python Packages - Platform Independent
Python Packages Support ๐ฆ
Pure Python Packages - Platform Independent
What about Native Python Packages?
Python Packages Support ๐ฆ
What about Native Python Packages?
Other Concerns
|
Flet |
Kivy |
PySide6 |
| Python Version |
3.11 |
3.11 |
3.11 |
| Android NDK Version |
r23b |
r25b |
r26b |
| Licenses |
Apache 2.0 |
MIT |
LGPLv3/GPLv3 and Commercial |
| App Size |
43 mB |
20.5 mB |
80 mB |
Conclusion ๐
Deploying your Python application to Android
Shyamnath Premnadh