How enable physical keyboard on Emulator in Android Studio? (Used to work)
Asked Answered
M

5

104

I'm not sure what changed but the physical keyboard from my computer no longer works for the emulator (running kitkat in Nexus 5, x86). When i look in AVD at the device's advanced settings, there's nothing for a hardware keyboard. Where is this setting?

Merimerida answered 25/11, 2014 at 21:0 Comment(0)
M
90

Find the emulator's configuration in your home directory:

//Located in:
~/.android/avd/<The_Device_Name>/config.ini

For example, on the Nexus 5 (created by Android Studio), it was:

~/.android/avd/Nexus5.avd/config.ini

Change the below setting to be:

hw.keyboard=yes
Merimerida answered 25/11, 2014 at 21:31 Comment(3)
Related: D'pad Is disabled in emulator. Modified as hw.dPad=yes to test accessibility feature with up, down, left , right arrow keys.Devaluate
Can this be set via adb shell or adbmanager command line?Goldsworthy
Also needed to restart the emulator afterward for the setting to be picked up. Anyone know if there's a way to use the new config without restarting emulator?Clan
R
158

In the advanced settings of a virtual device in Android Studio 1.0.2 AVD Manager, there is actually a checkbox that allows to enable keyboard input without editing the config.ini by hand.

Tools → Android → AVD Manager → pencil icon (shown in picture) → Show Advanced Settings (scroll to bottom) → Enable Keyboard Input

enter image description here

Rashad answered 18/1, 2015 at 12:58 Comment(3)
Note, you have to scroll down to the bottom of the Advanced Settings. "Enabled keyboard input" is the LAST ITEM. It took me several minutes to realize the advanced settings pane was much larger than it first appeared.Gipps
For me, it's enabled and still I can't type inside SOME EditText fields.Armandarmanda
IMPORTANT : Scroll to Bottom :)Sure
M
90

Find the emulator's configuration in your home directory:

//Located in:
~/.android/avd/<The_Device_Name>/config.ini

For example, on the Nexus 5 (created by Android Studio), it was:

~/.android/avd/Nexus5.avd/config.ini

Change the below setting to be:

hw.keyboard=yes
Merimerida answered 25/11, 2014 at 21:31 Comment(3)
Related: D'pad Is disabled in emulator. Modified as hw.dPad=yes to test accessibility feature with up, down, left , right arrow keys.Devaluate
Can this be set via adb shell or adbmanager command line?Goldsworthy
Also needed to restart the emulator afterward for the setting to be picked up. Anyone know if there's a way to use the new config without restarting emulator?Clan
C
61

Open and Navigate to Tools → Android → AVD Manager → Edit -> pencil icon)

enter image description here

Click on Show Advanced settings and scroll down and you can see the option Enable Keyboard input (example second image) Check that box and Click on Finish.

enter image description here

Convulsant answered 13/2, 2016 at 15:3 Comment(0)
S
7

UPDATE:

Change hw.keyboard = yes.

And make the file config.ini Read-only:

1.Right-click on the file open its settings.

2.Make every options on the permissions tab into Read-only(refer screenshot)

enter image description here

Trust me this will work it happens because this file gets rewritten,when we lock it out the bug disappears.

Salmonella answered 15/9, 2017 at 12:0 Comment(1)
@electrofant...No way you must have did unknowingly did something else along with itSalmonella
A
0

Quick script to do it automatically. Make sure to rename the emulator name part:

sed -i '' "s/hw.keyboard = no/hw.keyboard = yes/" $ANDROID_HOME/avd/[EMULATOR_NAME]/config.ini
Ambrotype answered 18/1, 2023 at 2:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.