Android emulator doesn't take keyboard input - SDK tools rev 20

AndroidAndroid Emulator

Android Problem Overview


I've upgraded the SDK tools to revision 20 (from 18) and since the upgrade, the emulator doesn't seem to accept input from laptop's keyboard. But only using the emulator's own 'soft' keyboard (that appears when an input field is focused).

I've tried reinstalling the SDK tools (and the whole SDK for that matter), uninstalled and reinstalled Eclipse Android plugins, re-created emulator devices. But none of that seem to help and its driving me mad. Its hopeless to key-in using a laptop's trackpad.

Has anyone encountered this problem?

Android Solutions


Solution 1 - Android

Update

As of SDK rev 21 the Android Virtual Device Manager has an improved UI which resolves this issue. I have highlighted some of the more important configuration settings below:

enter image description here

If you notice that the soft (screen-based) main keys Back, Home, etc. are missing from your emulator you can set hw.mainKeys=no to enable them.

enter image description here

Original answer

Even though the developer documentation says keyboard support is enabled by default it doesn't seem to be that way in SDK rev 20. I explicitly enabled keyboard support in my emulator's config.ini file and that worked!

Add: hw.keyboard=yes

To: ~/.android/avd/<emulator-device-name>.avd/config.ini

Similarly, add hw.dPad=yes if you wish to use the arrow-keys to navigate the application list.

Reference: http://developer.android.com/tools/devices/managing-avds-cmdline.html#hardwareopts

On Mac OS and Linux you can edit all of your emulator configurations with one Terminal command:

for f in ~/.android/avd/*.avd/config.ini; do echo 'hw.keyboard=yes' >> "$f"; done


On a related note, if your tablet emulator is missing the BACK/HOME buttons, try selecting WXGA800 as the Built-in skin in the AVD editor: enter image description here

Or by manually setting the skin in config.ini:

skin.name=WXGA800
skin.path=platforms/android-16/skins/WXGA800

(example is for API 16)

Solution 2 - Android

Confirmed. I had the same problem after upgrading to Tools version 20. I had to Edit the AVD to add an option as follows:

  1. From Eclipse, Go to AVD Mananger.
  2. Select the particular AVD and click on Edit
  3. Go to the Hardware section, click on New.
  4. Select the Property Name : Keyboard Support
  5. By default, it is added with a value of 'no'. Just click on the value column and change it to 'yes'.
  6. Click on Edit AVD again.

This will add a property hw.keyboard=yes in config.ini file for the AVD.

You also have to set hw.mainKeys = yes

Solution 3 - Android

In Android Studio, open AVD Manager (Tools > Android > AVD Manager). Tap the Edit button of the emulator: enter image description here

Select "Show Advanced Settings" enter image description here

Check "Enable keyboard input" enter image description here

Click Finish and start the emulator to enjoy the keyboard input.

Solution 4 - Android

Look in AVD Manager, select the AVD and click in Edit. In Hardware section: click in "New" and search for "Keyboard support" and add with OK button and set the value to "yes" and save changes with "Edit AVD"

Solution 5 - Android

Google wanted to give some more headache to the developers.

So, what you have to do now is edit your AVD and add "Keyboard Support" for it in the Hardware section and change the value to "Yes"

Solution 6 - Android

Add the following line hw.keyboard=yes to your AVD config file ~/.android/avd/<avd_folder>/config.ini

Solution 7 - Android

Restarting the emulator helps sometimes when typing is unavailable - despite keyboard input being enabled for your Android Virtual Device.

Solution 8 - Android

Just in case somebody finds it usefull.

I had a problem with the KEYCODE_DPAD_UP it belongs to the trackBall. to solve this change your avdfolder/config.ini hw.trackBall=yes and push DEL or F6

Solution 9 - Android

Here is some workaround that actually worked for me, it is the same solution as in the most popular answer - just add hw.keyboard=yes to config.ini but since this didn't work for me I additionally

  1. renamed config.ini (any name will do) to something like consssssfig.ini
  2. restarted emulator (obviously it didn't start)
  3. renamed config.ini back again
  4. (I am not sure if relevant) I added this new parameter (hw.keyboard=yes) at the beggining of config.ini file

Solution 10 - Android

Sometimes computer keyboard stops working on android emulator. Today I've noticed, that after pushing this button (that I marked with red arrow), keyboard starts working again (seems to be some issues with emulator window focus)

screenshot

Solution 11 - Android

Look for the hidden .android folder in your user home folder. You might rename or delete this folder, recreate your AVD, and restart the emulator. It could be there is a .ini file in that folder that has that setting munged.

Solution 12 - Android

Recreating an AVD with the Hardware Keyboard + setting the boolean to true was the only solution that worked for me; the other two main solutions (terminal or editing an existing AVD via GUI) both resulted in software/emulator crashes on my Mac. Making a new AVD resulted in the keyboard working just fine.

Solution 13 - Android

I have used an emulator for API Level 23, which does not take keyboard input for installed apk. So I have created new emulator for API Level 29, and then it works. Following is the step to install new emulator.

  1. Open "Android Virtual Device Manager"
  2. Create new Virtual Device.
  3. When you select a system image, please choose and download the last version(API Level29) on "Virtual Device Configuration" window

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionepsilonpsiView Question on Stackoverflow
Solution 1 - AndroidJames WaldView Answer on Stackoverflow
Solution 2 - AndroidRominView Answer on Stackoverflow
Solution 3 - AndroidHongView Answer on Stackoverflow
Solution 4 - AndroidJoel PelaezView Answer on Stackoverflow
Solution 5 - AndroidVincyView Answer on Stackoverflow
Solution 6 - AndroidAmit YaronView Answer on Stackoverflow
Solution 7 - AndroidZonView Answer on Stackoverflow
Solution 8 - AndroidPbxManView Answer on Stackoverflow
Solution 9 - AndroidWitoldView Answer on Stackoverflow
Solution 10 - AndroidwilddevView Answer on Stackoverflow
Solution 11 - AndroidEric CloningerView Answer on Stackoverflow
Solution 12 - AndroidDavek804View Answer on Stackoverflow
Solution 13 - Androidpersec10000View Answer on Stackoverflow