Android testbed: ensure managed emulator has 4GB RAM #144643
Closed
+337
−126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Title
gh-144418: Android testbed managed emulator uses 4GB RAM
Android testbed: ensure managed emulator has 4GB RAM
PR Description (paste into GitHub)
Fixes #144418.
The Android testbed’s Gradle Managed Devices sometimes create AVDs with only 2 GB RAM, which is borderline for running CPython’s test suite and requires manual post-creation edits. This change makes the RAM setting reproducible (including on fresh VMs like GitHub Actions / cibuildwheel users) by patching the managed AVD configuration after creation.
Changes
Adds minVersionPatchAvdRam / maxVersionPatchAvdRam Gradle tasks that set hw.ramSize=4096 in the AVD’s config.ini and hardware-qemu.ini.
Ensures the patch runs automatically:
after each *Setup task, and
before each *DebugAndroidTest task (so the RAM fix applies even if *Setup is up-to-date).
Locates the managed AVD robustly (uses .ini pointer path= when present; supports Windows paths and Gradle’s gradle-managed/ directory).
Removes the manual “edit hw.ramSize” paragraph from Android/README.md (the emulator is now configured automatically).
Makes Android/android.py require ANDROID_HOME lazily (only when SDK/adb is needed), which helps setup flows that download the Gradle wrapper before SDK configuration.
Testing
Windows:
.\gradlew.bat :app:minVersionSetup --rerun-tasks (observed minVersionPatchAvdRam logging ramMb=4096)
.\gradlew.bat :app:maxVersionSetup --rerun-tasks (observed maxVersionPatchAvdRam logging ramMb=4096)
Notes
Android/testbed/local.properties may be used locally to point Gradle at the SDK on Windows, but it is not intended to be committed.
If you want, I can also give you a one-liner “PR checklist” (branch name, exact git add, commit message, push, PR link) tailored to your fork remote names.