dataconnect(chore): headless_android_emulator_run.zsh minor improvements#8313
Conversation
…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
…to-detection do its thing
Using Gemini Code AssistThe 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
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 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. |
📝 PRs merging into main branchOur 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. |
Introduces several minor improvements and warning fixes to the
headless_android_emulator_run.zshscript 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
avdmanagerandsdkmanagercommands when no Android Virtual Devices (AVDs) are configured locally.-grpc-use-tokenflag and eliminated timezone zoneinfo warnings by switching the-timezoneflag value fromUTCto"Etc/UTC".-gpu offflag, allowing the emulator to default to automatic GPU detection for better rendering performance.Changelog
host_cpu_archfunction to detect the host machine's CPU architecture (arm64orx86_64).say_sample_create_avd_commandfunction to generate and output exampleavdmanagerandsdkmanagercommands for setting up a compatible AVD.-gpu offflag from the emulator launch options.-timezone UTCflag to-timezone "Etc/UTC".-grpc-use-tokenflag to secure gRPC access and silence warning messages.