Skip to content

Android CI fails when SDK or Robolectric downloads arrive corrupt #119

Open

Description

@owenthcarey

Android CI jobs sometimes fail before any test runs because a download from Google or Maven Central arrives corrupt. Rerunning the job passes, but the E2E workflow has about 15 Android shards per push, so a push hits this fairly often.

What happens

reactivecircus/android-emulator-runner installs the emulator and the system image with sdkmanager on every job. Now and then the archive is corrupt:

Warning: An error occurred while preparing SDK package Intel x86_64 Atom System Image: Error reading Zip content from a SeekableByteChannel.
...
error: could not connect to TCP port 5554: Connection refused

The emulator never starts, and the job fails in "Build, install, and run E2E tests" (or "Run the release configuration" in release-builds.yml) after about a minute.

native-android has the same problem with Robolectric, which downloads its android-all jar from Maven Central at test time. When that fails, every Robolectric test fails with AssertionError at MavenArtifactFetcher.java caused by an IOException.

How often

Out of about 395 Android jobs between Oct 9 and Nov 4, 2026:

Date Branch Job Cause
Oct 27 claude/pythonnative-architecture-analysis-5b85ba e2e-android (hooks-b) Android Emulator archive corrupt ("Error on ZipFile unknown archive")
Nov 3 feat/production-platform e2e-android (misc) Android Emulator archive corrupt
Nov 3 feat/production-platform native-android Robolectric jar download failed
Nov 4 feat/production-platform e2e-android (capabilities) System image archive corrupt

In the same period, the emulator also went offline mid-run twice (main on Nov 2, and Oct 23). That's the instability the sharding in e2e.yml already works around, so it's out of scope here.

Suggested fix

  • Cache the AVD between runs, as the runner's README describes: an actions/cache step for ~/.android/avd/* and ~/.android/adb*, keyed on the API level and arch, plus a step that creates the snapshot when the cache misses. Cached runs then skip the system image download. Apply it to both e2e.yml and release-builds.yml.
  • Cache ~/.m2/repository/org/robolectric in the native-android job, so Robolectric reads its jar from the cache instead of downloading it.
  • Optionally, retry the emulator step once when its log shows an SDK download error, for whatever the cache doesn't cover.

Done means a cold cache still works, a warm cache downloads no system image or Robolectric jar, and the existing shards pass unchanged.

Activity

  1. added
    bug
    on Nov 4, 2026
  2. TheoGoulart333 commented on Nov 7, 2026

    @TheoGoulart333
    Contributor

    Hi Owen, I’d like to help with this CI reliability issue. The AVD and Robolectric caching approach sounds like a useful focused change, and I’d be glad to pair on the implementation and validate cold- and warm-cache behavior. Would you be open to pairing on it? If so, could you assign the issue to me? I’ll wait for assignment before opening a PR, following the contributor guide.

  3. owenthcarey commented on Nov 7, 2026

    @owenthcarey
    ContributorAuthor

    Awesome! Assigned to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions