dotnet / dotnet/android

AVD creation should enable GPU acceleration in config.ini

Open
#12,076 1 comment 0 reactions 0 assignees View on GitHub
android-tools enhancement needs-triage
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 20h
Merged PRs (30d)
257

Description

## Problem

When creating an AVD via `AvdManagerRunner.GetOrCreateAvdAsync()`, the resulting `config.ini` has `hw.gpu.enabled = no` by default. This causes the emulator to show a black screen and fail to boot on newer API levels (36+), because SurfaceFlinger requires GPU support.

## Expected Behavior

After AVD creation, patch `config.ini` to set:
- `hw.gpu.enabled = yes`
- `hw.gpu.mode = auto` (already default)

This matches what `dotnet/android`'s `CreateAndroidEmulator.cs` MSBuild task does — it patches RAM size and disk partition after creation.

## Proposed Solution

Add a post-creation config patching step in `GetOrCreateAvdAsync()` that:
1. Locates the created AVD's `config.ini` (from the returned `AvdInfo.Path`)
2. Sets `hw.gpu.enabled = yes`
3. Optionally allows callers to provide additional config overrides (e.g., RAM size, disk partition size)

## Context

Discovered while debugging emulator boot failures with API 36 system images. The emulator starts but SurfaceFlingerAIDL service can't initialize without GPU → `sys.boot_completed` never becomes `1` → `pm install` fails with `Can't find service: package`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.