Repository navigation
Proposal: "Fast Push" workflow for Android - Python-only updates without rebuilding native assets (Huge DX boost for native-dependent apps) #6695
geanferreira96
started this conversation in
Show and tell
Replies: 1 comment 2 replies
|
I’ve been thinking about this issue for the past few days, and I didn’t expect you’ve already implemented this idea. Flet now features robust Python package integration and a straightforward GUI development experience. If hot reloading is supported on Android, it will be completely revolutionary. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Feature Request: Fast Python Code Push (Hot Reload-like Workflow for Custom Android APKs)
Background / Problem Statement
When developing Flet applications for Android, developers face a significant trade-off in the iteration cycle:
flet build apksuccessfully supports custom native integrations, but rebuilding the entire application takes several minutes for every small Python script change, making the developer feedback loop extremely slow.This means that as soon as a project needs a custom native dependency, developers completely lose the ability to rapidly iterate.
The Proposal
When only Python source files change (and no native files, Gradle configurations, assets, or dependencies have been modified), there is no technical need to rebuild the Flutter application shell or rerun the full Gradle compilation.
We could bridge this gap by implementing a "Fast Push" command that updates only the Python layer (
app.zip) directly inside an already compiled APK, signs it, and redeploys it to the device—achieving a development speed comparable to the utility app.How it Works (High-Level Concept)
An official implementation could follow these steps:
app.zip: Recompile and package only the Python files into a newapp.ziparchive.app.zipinside the target APK (treating the APK as a ZIP archive).serious_pythonextracts the newapp.zipon boot.zipalign, sign the modified APK with the developer's keystore, and install it on the target device via ADB.Proof of Concept (PoC)
I have built a working Proof of Concept demonstrating this exact workflow. It bypasses Gradle entirely and successfully reduces the iteration cycle from several minutes to roughly 5–10 seconds on a physical device.
Since release APKs are not debuggable (meaning we cannot use
adb run-asto manually wipe Flet's cached runtime assets inside/data), the PoC uses a script to locate and patch theversionCodedirectly inside the binaryAndroidManifest.xmlwithin the APK structure. This forces the Flet runtime (serious_python) to see it as a new version and perform a clean re-extraction of the updatedapp.zipon startup.The complete experimental implementation is available here:
🔗 placar-mirrror/scripts (GitHub)
It includes:
fast_push.ps1: The PowerShell orchestrator running compilation, ZIP injection, signing, and installation.apk_bump_version_code.py: A binary XML parser that incrementsversionCodedirectly in the manifest bytes to bypass extraction caching.Expected Benefits
All reactions