fix: enable emulator keyboard in Nix dev shell (#1193)
This commit is contained in:
2 files changed
+26
No files matched your search
@@ -91,6 +91,21 @@ If Hermes Mobile is useful to you, consider supporting its development on [Ko-fi
|
||||
|
||||
_Note: For release builds, ensure keystore environment variables (`KEYSTORE_PATH`, `KEYSTORE_PASSWORD`, `KEY_ALIAS`, `KEY_PASSWORD`) are configured, or let the GitHub Actions release workflow handle it on tag push (`v*`)._
|
||||
|
||||
### Nix emulator
|
||||
|
||||
The Nix development shell enables physical keyboard input in an existing
|
||||
`hermes_dev` AVD configuration. It respects `ANDROID_AVD_HOME` and
|
||||
`ANDROID_USER_HOME`, defaulting to `~/.android/avd`.
|
||||
|
||||
Close any running emulator, then cold boot once to apply the setting:
|
||||
|
||||
```bash
|
||||
nix develop --command emulator -avd hermes_dev -no-snapshot-load
|
||||
```
|
||||
|
||||
Subsequent launches can omit `-no-snapshot-load`. Create the `hermes_dev` AVD
|
||||
first if it does not exist; the shell does not create one.
|
||||
|
||||
---
|
||||
|
||||
## Authentication
|
||||
|
||||
@@ -93,6 +93,17 @@
|
||||
# Writable gradle home
|
||||
mkdir -p "$GRADLE_USER_HOME"
|
||||
|
||||
# Enable host keyboard input for the project's existing AVD.
|
||||
hermesAvdConfig="''${ANDROID_AVD_HOME:-''${ANDROID_USER_HOME:-$HOME/.android}/avd}/hermes_dev.avd/config.ini"
|
||||
if [ -f "$hermesAvdConfig" ]; then
|
||||
if ${pkgs.gnugrep}/bin/grep -q '^hw\.keyboard[[:space:]]*=' "$hermesAvdConfig"; then
|
||||
${pkgs.gnused}/bin/sed -i 's/^hw\.keyboard[[:space:]]*=.*/hw.keyboard=yes/' "$hermesAvdConfig"
|
||||
else
|
||||
printf '\nhw.keyboard=yes\n' >> "$hermesAvdConfig"
|
||||
fi
|
||||
fi
|
||||
unset hermesAvdConfig
|
||||
|
||||
# ADB Screen Resolution Aliases
|
||||
alias avd-phone='adb shell wm size 1440x3120 && adb shell wm density 500'
|
||||
alias avd-phone-fhd='adb shell wm size 1080x2400 && adb shell wm density 420'
|
||||
|
||||
Reference in new issue
Block a user