beeware / beeware/briefcase

Improve flexibility of Android emulator system image

Open
#737 15 comments 0 reactions 0 assignees View on GitHub
android enhancement good first issue
Dominant language
Python
Stars
3.3k
Forks
549
Avg merge
1d 4h
Merged PRs (30d)
40

Description

The Android toolchain currently hard-codes the system image that is used on emulator images built by Briefcase (at time of writing, the default Android-31 image is used). This system image is downloaded when the emulator binary is downloaded, and is never directly updated.

This has some unfortunate side effects:
1. If a user has an emulator created by a different set of tools (e.g., Android Studio), the emulator will appear in the list of available emulators, but won't be able to start
2. A user can't intentionally choose a different base image - e.g., to test older/newer devices.
3. A user can't intentionally choose a base image other than the Default image (e.g., a Google Play enabled image)

**Describe the solution you'd like**

It would be desirable for Briefcase to:
1. provide the option of selecting a base image from the list provided by the SDK manager
2. check that the system image required by an emulator is available before trying to start the image

**Describe alternatives you've considered**

There aren't really any alternatives, other than manually invoking sdkmanager to create images and download system images that meet your requirements.

**Additional context**

`sdkmanager` is a tool provided by the Android toolchain to do package management. Run `briefcase run -v` to see examples of how it can be run, including the environment variables that must be set in order to invoke it.

`sdkmangager --list` will give you a list of available images; any package starting with `system_images;` is, as the name suggests, a system image. The default system image used by briefcase on M1 hardware is `system-images;android-31;default;arm64-v8a` (system images are architecture dependent; only architecture-appropriate options should be provided).

`sdkmangager --list_installed` will give you a list of images that are currently installed.

`sdkmanager ` will download and install a package.

Android emulators (called AVDs) are stored in `~/.briefcase/avd`. There is a `.ini` config file and a `.avd` directory for each emulator, with the name of these files matching the emulator name. The `.avd` folder contains a `config.ini` that details the system image required by the AVD under the `image.sysdir.1` key (e.g., `image.sysdir.1=system-images/android-31/default/arm64-v8a/`)

Contributor guide

Open the contributing guide

Research direction

Start with `briefcase run -v` to review how the Android toolchain invokes `sdkmanager`, then inspect the AVDs under `~/.briefcase/avd`, including each `.avd/config.ini` and its `image.sysdir.1` value. Use `sdkmanager --list` and `--list_installed` to understand available and installed system images. Done means users can choose an architecture-appropriate image and Briefcase checks that an AVD's required image is available before starting it.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, python
Domain
mobile, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.