Skip to content

Give each Android download task its own ETag cache; bump to 6.1.4 - #264

Merged
FeodorFitsner merged 2 commits into
mainfrom
fix/android-download-etag-race
Nov 29, 2026
Merged

FeodorFitsner merged 2 commits into
mainfrom
fix/android-download-etag-race

Conversation

@FeodorFitsner

@FeodorFitsner FeodorFitsner commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes a race that fails Android builds on a cold download cache. It broke every Android flet build job in flet's CI on flet-dev/flet#7156 (the Flutter 3.50.1 bump):

Execution failed for task ':serious_python_android:downloadDistArchive_x86_64'
> A failure occurred while executing de.undercouch.gradle.tasks.download.internal.DefaultWorkerExecutorHelper$DefaultWorkAction
   > Unable to determine the current character, it is not a string, number, array, or object

Cause

The six download tasks (downloadDistArchive_<abi> and downloadDartBridge_<abi>) all used useETag("all") with gradle-download-task's default cache file, download-task/etags.json.

  • The plugin (5.6.0) truncates and rewrites that file after every download, and parses it before each one.
  • Its lock belongs to a single task, so nothing coordinates the six of them.
  • Download tasks run their work through the Worker API, so Gradle runs them at the same time within the project, even without --parallel.

A task could therefore parse the file while another task was halfway through rewriting it. This only happens when the files are actually downloaded, i.e. with an empty ~/.flet/cache or FLET_CACHE_DIR, which is always the case on CI.

Fix

Each task keeps its own ETag file, download-task/<task name>.etags.json, via cachedETagsFile(...). Conditional downloads still work.

Verified

Tested with a flet build project on Flutter 3.50.1 (AGP 9.3.1, Gradle 9.5.0), running the six download tasks from an empty cache:

  • Before the fix: 2 of 10 runs failed with the error above.
  • With the fix: 20 of 20 runs passed, each task writing its own ETag file.
  • A second run with a filled cache sends the stored ETag and leaves the cached archive untouched.
  • assembleRelease builds the APK.

Bumps all packages to 6.1.4 for release.

The downloadDistArchive_<abi> and downloadDartBridge_<abi> tasks all used
useETag("all") with gradle-download-task's default cache file,
download-task/etags.json. The plugin (5.6.0) truncates and rewrites that
file with a PrintWriter after every download and parses it with
JsonSlurper before each one, under a lock that belongs to a single task.
Download tasks submit their work through the Worker API, so Gradle runs
them concurrently within the project, and a task could parse a file
another task was rewriting:

  Execution failed for task ':serious_python_android:downloadDistArchive_x86_64'
  > Unable to determine the current character, it is not a string,
    number, array, or object

It shows up on a cold download cache (~/.flet/cache or FLET_CACHE_DIR),
where all six files are fetched. With Flutter 3.50.1 (AGP 9.3.1,
Gradle 9.5.0) every Android `flet build` job in flet's CI failed this
way. Locally, the six tasks from an empty cache failed 2 runs in 10.

Each task now keeps its ETags in download-task/<task name>.etags.json.
Conditional downloads still work: a second run sends the stored ETag and
leaves the cached archive untouched.

Verified with a `flet build` project on Flutter 3.50.1 pointed at this
package: 20 of 20 cold runs of the six tasks passed, and assembleRelease
built the APK.
@FeodorFitsner FeodorFitsner changed the title Give each Android download task its own ETag cache Give each Android download task its own ETag cache; bump to 6.1.4 Nov 29, 2026
@FeodorFitsner
FeodorFitsner merged commit 4cdfda6 into main Nov 29, 2026
81 of 91 checks passed
FeodorFitsner added a commit to flet-dev/flet that referenced this pull request Nov 29, 2026
serious_python 6.1.4 gives each Android download task its own ETag
cache (flet-dev/serious-python#264). The six per-ABI download tasks run
concurrently and shared one etags.json, so on a cold download cache a
task could parse the file while another rewrote it, failing every
Android `flet build` job on this branch with "Unable to determine the
current character, it is not a string, number, array, or object".
FeodorFitsner added a commit to flet-dev/flet that referenced this pull request Nov 30, 2026
…#7156)

* chore: bump Flutter to 3.50.1; Android builds on AGP 9.3.1 and JDK 21

Flutter 3.50 rejects Android Gradle Plugin versions below 9.1.1, Kotlin
below 2.4.10 and Gradle below 9.3.1 (DependencyVersionChecker.kt), so the
client and the `flet build` template move to the versions in Flutter's own
3.50.1 app template: AGP 9.3.1, Kotlin 2.4.20 and Gradle 9.5.0.

* Keep the old AGP DSL and the Kotlin Gradle Plugin

With AGP 9's defaults (android.newDsl=true, android.builtInKotlin=true),
android_file_picker 2.1.1 fails to configure: it looks up the old
`LibraryExtension`. Flutter's app template sets both properties to false
for plugin compatibility; the client does the same, and
get_android_gradle_properties() adds them to the template's defaults,
still overridable in [tool.flet.android.gradle_properties]. Flutter warns
that pasteboard, rive_native and webview_flutter_android apply the Kotlin
Gradle Plugin themselves, which a future Flutter release will reject.

* Install JDK 21 for Android builds

AGP 9.3.1's lintVital tasks call List.removeLast(), a Java 21 API, so
every release build failed on JDK 17 with "Unexpected failure during lint
analysis" (NoSuchMethodError, first in camera_android_camerax). flet-cli
now installs Temurin 21.0.13.1+2 instead of 17.0.13+11. Java 17 stays the
compile target. Temurin 21 has no 32-bit ARM Linux build.

Flutter 3.50 ships Dart 3.14.0; `flutter analyze` reports no new issues in
the client, packages/flet or the extensions. The client lock picks up the
SDK-pinned clock, stack_trace, test_api and listen, and Flutter 3.50 sorts
the generated plugin registrants differently.

Verified: client `flutter build apk --debug` and `--release` (JDK 21, no R8
warnings), web, macOS debug, iOS simulator debug, and `flet build apk` from
the local template with flet-video, flet-webview, flet-secure-storage and
flet-audio-recorder.

* Link the PR in the changelogs

* Bump serious_python to 6.1.4

serious_python 6.1.4 gives each Android download task its own ETag
cache (flet-dev/serious-python#264). The six per-ABI download tasks run
concurrently and shared one etags.json, so on a cold download cache a
task could parse the file while another rewrote it, failing every
Android `flet build` job on this branch with "Unable to determine the
current character, it is not a string, number, array, or object".

* ci: pin the Android emulator to 37.2.13 in flet test

With emulator 37.3.10, which android-emulator-runner installs by default,
the device drops right after the app starts or a test ends: the
android (py3.14) job failed with "registerService: (-32000) Service
connection disposed" after the APK installed. serious-python's Android
jobs failed the same way on every run until emulator-build pinned 37.2.13
(build 16740729, flet-dev/serious-python#265).

* Drop the Debian 10 and Ubuntu 20.04 Linux client builds

The Dart SDK in Flutter 3.50.1 needs glibc 2.34 on ARM64 (Ubuntu 20.04
ARM64 failed with "GLIBC_2.34 not found"), so the Linux client can no
longer be built on Ubuntu 20.04. Debian 10 goes too, leaving Ubuntu
22.04 (glibc 2.35) as the oldest build on both architectures.

- ci.yml: remove the Debian 10 AMD64 and Ubuntu 20.04 AMD64/ARM64 matrix
  entries and the Debian 10 archive-mirror apt setup.
- flet-desktop: drop debian10 and ubuntu20.04 from _GLIBC_DISTRO_TABLE.
  A system with glibc older than 2.35 now gets "Flet desktop client for
  Linux <arch> requires glibc 2.35 or newer". Tests use ubuntu22.04 where
  they used ubuntu20.04 and check the error for glibc 2.28, 2.31 and 2.34
  on both architectures.
- Docs: supported distros in the installation guide, the
  FLET_LINUX_DISTRO build table, and the Rocky/AlmaLinux 9 and libmpv1
  notes in the Video docs and the flet-audio/flet-video READMEs.

* Fix the Build Docs checks: Gauge chart images and Dropdown cross-references

- gaugechart.md pointed example_images at test-images-charts/..., which
  doesn't exist, so the page's three images were broken. Use the path the
  other chart pages use, test-images/examples/extensions/charts/golden/
  macos/gauge_chart, where the golden images are.
- The Dropdown docstrings used :attr:`width` and :attr:`expand`, which
  Dropdown inherits. The xref map lists inherited members only under the
  class that defines them, so the roles rendered as raw text and failed
  the unresolved reST cross-reference check. Point them at
  flet.LayoutControl.width and flet.Control.expand.

`yarn build` now passes every docs check.

* Fix desktop resize teardown and retain Ubuntu 20.04 AMD64 support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant