Android CI fails when SDK or Robolectric downloads arrive corrupt

Open
#119 2 comments 0 reactions 1 assignee View on GitHub

@TheoGoulart333 is already working on this.

Since Nov 7, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, github-actions
Domain
ci-cd, mobile

Research direction

Start by reading .github/workflows/e2e.yml, .github/workflows/release-builds.yml, and the native-android workflow job to find where the emulator and Robolectric dependencies are installed. Check the Android emulator runner README for its AVD cache and snapshot setup. Done means cold caches work, warm runs skip system image and Robolectric jar downloads, and the existing shards pass unchanged.

Written by the indexing model from the issue text.

Description

bug

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.

Dominant language
Python
Stars
131
Forks
22
Avg merge
3d 2h
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pythonnative/pythonnative

All issues in pythonnative/pythonnative

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.