Skip to content

dataconnect(chore): headless_android_emulator_run.zsh minor improvements#8313

Merged
dconeybe merged 5 commits into
mainfrom
dconeybe/dataconnect/headless_android_emulator_run_help
Jun 17, 2026
Merged

dataconnect(chore): headless_android_emulator_run.zsh minor improvements#8313
dconeybe merged 5 commits into
mainfrom
dconeybe/dataconnect/headless_android_emulator_run_help

Conversation

@dconeybe

@dconeybe dconeybe commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Introduces several minor improvements and warning fixes to the headless_android_emulator_run.zsh script for Data Connect SDK development. These enhancements improve emulator performance, secure the gRPC port, resolve timezone warnings, and provide helpful setup commands when no AVDs are configured.

Highlights

  • AVD Creation Helper: Implemented host CPU architecture detection and added helper functions to print sample avdmanager and sdkmanager commands when no Android Virtual Devices (AVDs) are configured locally.
  • Warning Fixes: Resolved gRPC security warnings by adding the -grpc-use-token flag and eliminated timezone zoneinfo warnings by switching the -timezone flag value from UTC to "Etc/UTC".
  • Auto-GPU Detection: Removed the hardcoded -gpu off flag, allowing the emulator to default to automatic GPU detection for better rendering performance.
Changelog
  • headless_android_emulator_run.zsh
    • Added host_cpu_arch function to detect the host machine's CPU architecture (arm64 or x86_64).
    • Added say_sample_create_avd_command function to generate and output example avdmanager and sdkmanager commands for setting up a compatible AVD.
    • Updated AVD verification logic to output these setup commands and exit when no AVDs are configured.
    • Removed the hardcoded -gpu off flag from the emulator launch options.
    • Changed the -timezone UTC flag to -timezone "Etc/UTC".
    • Added the -grpc-use-token flag to secure gRPC access and silence warning messages.

dconeybe added 5 commits June 17, 2026 11:13
…pu off" to get better performance by offloading gpu operations to the gpu rather than emulating them in software.

This also fixes the following warning emitted by the android emulator:

```
WARNING      | Your AVD has been configured with an in-guest renderer, but the system image does not support guest rendering.Falling back to 'lavapipe' mode.
```

This warning happens because there is a mismatch between how your AVD config file tells the emulator to render graphics and what the Android system image is actually capable of doing.

Specifically, you have -gpu off in your startup command, which forces the emulator to look for a guest renderer (software-based rendering inside the Android OS itself). However, modern Google API system images (especially newer ones like API 36) have stripped out legacy guest renderers, forcing the emulator to fall back to lavapipe (a CPU-based Vulkan software renderer on your host machine).

Since you are running headless (-no-window), you have two ways to fix this depending on what your host machine supports.

Solution 1: Use Host Swiftshader (Recommended for Headless)
Instead of forcing the GPU completely "off" (which triggers the guest rendering mismatch), tell the emulator to use Swiftshader. Swiftshader is a high-performance software renderer that runs on your host CPU. It is perfect for headless CI/CD pipelines because it doesn't require a physical graphics card but is fully supported by modern system images.

Change your -gpu off flag to -gpu swiftshader_indirect

Solution 2: Use Host Hardware Acceleration (If available)
If the machine running this terminal command actually has a dedicated GPU (like an NVIDIA card on a Linux server or Apple Silicon graphics on a Mac), you should let the emulator use it. It will dramatically speed up performance, even without a window UI.

Change your -gpu off flag to -gpu host

Why "lavapipe" isn't ideal
While the emulator successfully "falls back" to lavapipe and will technically still run your tests, lavapipe is incredibly CPU-intensive and unoptimized for the Android emulator environment. Switching to swiftshader_indirect will quiet the warning and likely give your automated tasks a noticeable speed boost.
…d of "-timezone UTC"

This fixes the following warning from the android emulator:

```
emulator: it seems the timezone 'UTC' is not in zoneinfo format
```
This fixes the following warning from the Android emulator:

```
WARNING      | The emulator now requires a signed jwt token for gRPC access! Use the -grpc flag if you really want an open unprotected grpc port
```

This warning is a relatively recent security update introduced by Google to protect your machine.

The Android emulator uses an internal framework called gRPC to allow external tools (like Android Studio, Appium, or your own scripts) to communicate with it, control it, and stream video or audio. To prevent malicious scripts on your computer or local network from hijacking your emulator, Google locked this down by requiring a signed security token (JWT) for any gRPC requests.

Since you are spinning up the emulator manually via the terminal, it detects that no token was generated, flashes this warning, and blocks unauthenticated access.

Tell it to run securely using the local secure token pattern. Android Studio passes this flag by default when launching behind the scenes:

```
-grpc-use-token
```

This forces the emulator to protect the port using a local token file, completely silencing the "unprotected" security warning.
…ager commands where no avds are configured locally
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@github-actions

Copy link
Copy Markdown
Contributor

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

@dconeybe dconeybe marked this pull request as ready for review June 17, 2026 15:40
@dconeybe dconeybe merged commit 9ddc6c3 into main Jun 17, 2026
41 checks passed
@dconeybe dconeybe deleted the dconeybe/dataconnect/headless_android_emulator_run_help branch June 17, 2026 16:05
@github-actions github-actions Bot mentioned this pull request Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants