serious_python_android 4.1.1
serious_python_android: ^4.1.1 copied to clipboard
Android implementation of the serious_python plugin
4.1.1 #
- Fix app crashing on launch on Android 8.1 and below (API < 28). The
getAppVersionmethod-channel handler, called on every startup, usedPackageInfo.getLongVersionCode()(API 28+) unconditionally. R8 outlines this call into a synthetic class that it can merge with other API 28+ outlines — notably Flutter 3.41'sImageDecoder-based image decoder — and invoking that merged class on API < 28 fails verification withNoClassDefFoundError: android.graphics.ImageDecoder$OnHeaderDecodedListener. The call is now guarded with aBuild.VERSION.SDK_INTcheck, falling back to the deprecatedversionCodeint field on older devices. - Fix the embedded interpreter crashing on startup on a non-primary ABI (e.g. an x86_64 emulator when
arm64-v8ais the primary ABI) withModuleNotFoundError: No module named '_sysconfigdata__android_<arch>-linux-android'. The ABI-commonstdlib.zipwas built from the primary ABI only, dropping every other ABI's arch-specific_sysconfigdata__android_<arch>module — which CPython imports at startup viasysconfig(pulled in byctypes). The primarysplitStdlibtask now also harvests each other ABI's_sysconfigdata__android_<arch>intostdlib.zip(only that arch-specific module, so the generic ABI-identical_sysconfigdata__linux_shipped by some versions like 3.12 isn't duplicated).
4.1.0 #
- Run the
extractAsset/unzipAsset/loadLibrarymethod-channel handlers on a backgroundExecutor(posting theResultback on the main looper) instead of inline on the platform main thread. The first-launch asset unpack and the pyjnius native-library load no longer block Android'sChoreographer, so Flutter's vsync isn't starved and on-screen animations (e.g. a boot/splash spinner) stay smooth while the app starts. - Ship consumer ProGuard/R8 keep rules (
-keep class com.flet.serious_python_android.** { *; }) so release (minified) builds don't obfuscate or strip the classes pyjnius resolves by name at runtime. Without them R8 renamedPythonActivityand dropped its staticmActivityfield, breaking pyjnius in release builds withtype object 'C.f' has no attribute 'mActivity'(debug builds were unaffected). - Version bump aligning with the
serious_python_*4.1.0 release.
4.0.0 #
- Ship the app as a stored
app.zipasset in the APK and unpack it once (version-keyed) to<application-support>/flet/appon the first launch after install/update, via the newprepareApp(). The version-keyed unpack moved out ofrun(); user data in the sibling<application-support>/datais preserved across updates. - Resolve the support dir via
path_providergetApplicationSupportDirectory()(==context.getFilesDir()) and drop the customgetFilesDirmethod channel; the payload base moves fromflet/pytoflet/. - Synthesize an empty
__init__.pyfor__init__-less package directories when buildingstdlib.zip/sitepackages.zip, sozipimportcan import PEP 420 namespace packages (e.g.flask.sansio). SERIOUS_PYTHON_ANDROID_EXTRACT_PACKAGESentries now support*/?wildcards matched against the top-level name (e.g.flask*also extractsflask-<version>.dist-info/).- Restore
pyjniussupport under the FFI model: re-add theloadLibrarymethod channel and load its JNI helper (libpyjni.so) via JavaSystem.loadLibrarybefore the interpreter starts, so the helper'sJNI_OnLoadcaptures theJavaVM+ app ClassLoader (dart:ffi'sdlopenforlibdart_bridgenever triggersJNI_OnLoad). Best-effort — a no-op for apps that don't depend on pyjnius. - Version bump aligning with the
serious_python_*4.0.0 release.
3.0.0 #
- In-process Python (dart_bridge FFI). The Python lifecycle now runs through
libdart_bridge.so(fromflet-dev/dart-bridge1.4.0) instead of a socket transport. - Native modules are memory-mapped from the APK — no more
useLegacyPackaging. Python extension modules (stdliblib-dynloadand site-packages) are relocated intojniLibs/<abi>/lib<mangled>.soand loaded directly from the APK by a customsys.meta_pathfinder that resolves them from.sorefmarkers — no extraction to disk, still ABI-split by the Play Store. Pure Python ships in stored, ABI-common asset zips read viazipimport, so the stdlib is no longer duplicated per ABI. This replaces the previous scheme of zipping stdlib/site-packages into fakelib*.sofiles (which requireduseLegacyPackaging). The dart-bridge Android binary now uses the full CPython API (PyConfig) to install the finder beforesiteruns. SetSERIOUS_PYTHON_ANDROID_EXTRACT_PACKAGES(comma-separated relative paths) to ship path-hungry packages extracted to disk instead. - Breaking change: requires Flutter 3.44.2. Moves to AGP 8.11.1, Gradle 8.11.1,
compileSdk36, Java 17, and the Kotlin-DSL Gradle build (build.gradle.kts). build.gradleresolves the Python version from the generatedpython_versions.properties(a snapshot of python-build'smanifest.json):SERIOUS_PYTHON_VERSIONselects the version; the full version, build date anddart_bridgeversion derive from the table, withSERIOUS_PYTHON_FULL_VERSION/SERIOUS_PYTHON_BUILD_DATE/DART_BRIDGE_VERSIONleft as escape hatches. Downloads continue to use python-build's date-keyed release scheme.- Drop the
x86(32-bit Intel) ABI — Flutter no longer produces it. ABIs arearm64-v8a+x86_64(plusarmeabi-v7aon Python 3.12). - Remove the scaffold
getPlatformVersionmethod.
2.0.0 #
- Breaking change: default bundled Python version is now 3.14 (was 3.12). Apps built without an explicit
SERIOUS_PYTHON_VERSIONenv var pull the 3.14 python-build distribution and shiplibpython3.14.so. SetSERIOUS_PYTHON_VERSION=3.12(typically threaded throughflet build) to preserve the previous default. - Multi-version Python support.
python_versioninandroid/build.gradlereads fromSERIOUS_PYTHON_VERSIONand drives theflet-dev/python-builddownload URL. - The Dart runtime no longer hardcodes
libpython3.12.so— it scansnativeLibraryDirforlibpython3.*.soso whichever libpython the plugin bundled is loaded automatically. abiFiltersnow branches onpython_version: keeparmeabi-v7afor 3.12, restrict toarm64-v8a+x86_64for 3.13+ (python-build dropped 32-bit Android per PEP 738).
1.0.1 #
Improvements #
- Cache downloaded Python distribution tarballs (
python-android-dart-<py>-<abi>.tar.gz) across builds. ThedownloadDistArchive_*Gradle tasks now write to a persistent cache directory —$FLET_CACHE_DIR/python-build/v<python_version>/if the env var is set, otherwise~/.flet/cache/python-build/v<python_version>/— and useonlyIfModified true+useETag "all"so subsequent builds issue a conditional GET (If-None-Match/If-Modified-Since) againstobjects.githubusercontent.cominstead of re-downloading 30–100 MB per ABI per build. When the upstream release republishes a tarball at the same URL (e.g. a Python patch update under the existingv<py>release), the validators flip and the cache refreshes automatically; otherwise the build skips the download entirely.tempAndMove trueguards against partial downloads being kept in the cache (flet-dev/flet#6555, #208) by @FeodorFitsner.
Bug fixes #
1.0.0 #
- Breaking change:
--platformargument valuePyodidehas been renamed toEmscriptento match whatplatform.system()returns in the Pyodide runtime, so PEP 508 markers likeplatform_system != 'Emscripten'work consistently.
0.9.10 #
- Android: Add debug logs and deduplicate FFI imports.
- Android: Invalidate extracted assets when version keys change.
0.9.9 #
- Add zipDirectoryPosix to create POSIX-compliant app archives on Windows.
- Enforce C++20 standard for
serious_pythonplugin build. - Fix: Normalize
WINDIRpath for bundled DLLs in CMake. - Fix Logcat logging crash on some Android devices.
0.9.8 #
- Fix logging on Android.
0.9.7 #
- Fix app restart on Android 10.
- Redirect Python output to logcat.
0.9.6 #
- Make zipDirectory call asynchronous.
0.9.5 #
- Bump
archiveto^4.0.7. - Fixed iOS framework identifier generation.
0.9.3 #
- Fix: Hidden files in site-packages are skipped when building macOS app.
- Fix: Do not delete package metadata in
.dist-infodirectories (#164).
0.9.2 #
- Breaking change: multiple
--requirementsoptions ofpackagecommand must be passed as--requirements DEP_1 --requirements DEP_2 ...(or-r DEP_1 -r DEP_2 ...) instead of-r DEP_1,DEP_2,...to support dependency specifications with commas, e.g.pandas>=2.2,<3. - Fix site-packages packaging for Pyodide platform.
0.9.1 #
- Fix
serious_pythonto work on macOS 12 Monterey and built with Xcode 14.
0.9.0 #
- Set
MinimumOSVersionto13.0for generated Python frameworks. - iOS and macOS packaging: Python system libraries are put into
python.bundleto pass App Store verification. - On macOS, Windows, and Linux, application site packages are copied in an unpacked state to the application bundle to speed up the first launch.
- Pyodide 0.27.2
- Python 3.12.9
- Packaging
--cleanupoption replaced with two separate--cleanup-appand--cleanup-packagesoptions. - New packaging options
--cleanup-app-filesand--cleanup-package-filesto specify a list of globs to exclude files and directories from app and site packages. - New packaging
--skip-site-packagesoption to skip site packages installation for faster re-builds. - Packaging
--archoption accepts a list now.
0.8.7 #
- Fixed:
xcframeworksmigration script didn't work for sub-directories.
0.8.6 #
- Added
com.flet.serious_python_android.PythonActivityholder class withmActivityholding a reference to an app MainActivity. Needed forplyer. - Android plugin sets
MAIN_ACTIVITY_HOST_CLASS_NAMEenvironment variable with the name of activity holder class name (com.flet.serious_python_android.PythonActivity). - Android plugin sets
MAIN_ACTIVITY_CLASS_NAMEenvironment variable with a class name of an app MainActivity. - Android plugin sets
ANDROID_NATIVE_LIBRARY_DIRenvironment variable with the path to a directory containing app .so libraries. Needed for patchingctypes.find_library. - Changed behavior of
SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONSenvironment variable that should contain a comma-separated list of packages to allow installation from source distribution. - Fixed: iOS
site-packagestoxcframeworksmigration script supports bothlibrary.soandlibrary.{something}.so.
0.8.4 #
- Copy
site-packages/fluttercontents toSERIOUS_PYTHON_FLUTTER_PACKAGES. - Added
SERIOUS_PYTHON_ALLOW_SOURCE_DISTRIBUTIONSvariable to allow pip installing from source distributions.
0.8.3 #
- Remove
PYTHONOPTIMIZE=2to make CFFI work.
0.8.2 #
- Copy
.solibraries from{site-packages}/opttojniLibs.
0.8.1 #
0.8.0 #
- New packaging, not based on Kivy and with pre-built binary packages.
0.7.1 #
- Added
namespacedefinition to Android Gradle build. - Bump dependencies.
0.7.0 #
runPython()method to support running Python script.- Updated
flet_exampleto catch program output and errors,sys.exit()support. packagecommand to read dependencies frompyproject.toml.
0.6.1 #
--excludeoption forpackagecommand - to exclude directories and files from Python app package.- Re-create temp Python distributive directory on every run of
packagecommand.
0.6.0 #
--verboseflag - verbose output.--mobileflag - (removes.so) from app dest archive.--webflag for packaging for pyodide.--find-linksoption for installing pip dependencies from alternative sources (indexes).--dep-mappingsfor rewritingfletdependency to eitherflet-embedorflet-pyodide.--req-depsfor adding required dependencies likeflet-embedorflet-pyodide.--platformoption for use withsitecustomize.pyto tweak pip to pull platform-specific packages.- More structured regular output.
- Bump deps versions.
0.5.1 #
- Simplified Python initialization on Android.
0.5.0 #
- Python 3.11.6.
0.4.1 #
- Bumping version after fixing pubspec.yaml.
0.4.0 #
- macOS, Windows and Linux support.
0.3.0 #
Initial version.