141

I want to run/test Android apps on the Android emulator and I want to type using my PC keyboard, as it lets me type and test faster.

When I use the emulator though, it only accepts input from the native Android (on-screen) keyboard. How can I enable my PC keyboard for use within the Android emulator?

4
  • 1
    My keyboard works with default settings on an emulator instance. Do you have any advanced settings configured for your AVD? What OS are you running? I'm not entirely sure what would have an effect on this, but we might need more detail on your setup. May 23 '12 at 13:39
  • I didn't do any thing thing special other than normal settings, and my OS is Win7 32bit
    – Hafiz
    May 24 '12 at 5:27
  • 1
    As @eldareathis said, by default, your keyboard should work in the emulator... Not sure what would cause it to not work
    – Bryan Denny
    May 24 '12 at 17:44
  • originally this question as asked at the time when I was using Eclipse and now most people including me use Android studio and I don't have this issue any more so should I just close this question ?
    – Hafiz
    Jan 12 '16 at 19:06
120

I had the same issue after upgrading the developer tools (v20.0.0v2012...). All of a sudden none of my android virtual devices would accept any input from my physical PC/Mac keyboard.

This is how I fixed it:

  1. Eclipse > Window menu > AVD Manager
  2. Select your virtual device and click Edit
  3. Under Hardware, Click New
  4. Select Keyboard Support then click OK
  5. Edit its value to yes
  6. Now you have to click off onto another item in the list, like "Abtract LCD Density" or something. This seems to make the UI keep the "yes" change.

My other AVDs that don't have this "keyboard support" hardware property added do NOT accept my physical keyboard input.

3
  • 3
    Seems like a bug for me. This trick works. Jul 3 '12 at 5:38
  • 2
    Doesn't work for me, the Keyboard Support value resets back to "no" after saving and closing out the window...
    – Justin
    Aug 31 '12 at 14:13
  • 1
    Justin, my original post mentioned a click-off step but some dummy (looking at you Flow or ce4) removed that info. After you change to "yes" click-off onto another item in the list and this seems to make the UI remember the "yes" setting. I updated my butchered post with a step 6. :-) Sep 5 '12 at 5:23
19

Please try the following settings. My environment (Target: Android 4.0.3 - API Level 15) successful.

AVD - Edit - Hardware: - New... - Keyboard support - yes

AVD - Edit - Hardware: - New... - Keyboard lid support - no

2
  • Do you know of a way to enable while the emulator is running?
    – jcollum
    Jul 20 '12 at 18:20
  • 1
    What's up with the Keyboard lid support?
    – KevinOrr
    Mar 24 '13 at 23:13
10

You need to change the config.ini file in your .android directory. This file is found under the main hard drive directory.

From there, open the avd file and you will see a list of virtual devices. Open the desired device and then open the config.ini in notepad. Then copy this text: hw.keyboard = yes and then save and close. The next time you open your emulator, you should be able to use the keyboard.

You can also open up the hardware-qemu.ini file in the same directory as the config.ini file, and then you can see a list of all the hardware options. Change the hw.keyboard from no to yes.

Hope this helps!

6

This answer is for those who built the emulator from source (i.e. Following instructions from source.android.com). You need to modify a property in the following file:

external/qemu/android/avd/hardware-properties.ini

In the following section of that file change the default value from no to yes:

# Keyboard support (qwerty/azerty)
name        = hw.keyboard<br/>
type        = boolean<br/>
default     = yes<br/>
abstract    = Keyboard support<br/>
description = Whether the device has a QWERTY keyboard.<br/>

Then rebuild (using make). At least this worked for me.

1
  • 2
    It's even easier. You can set this property in the AVD manager: Add a key 'keyboard' with value 'yes' in the hardware properties list.
    – ce4
    Sep 3 '12 at 19:19
4

I had this issue despite having the correct configuration, and realized that the actual problem was that the focus was on the emulator control buttons windows, as reported in this issue.

To check if this is your problem, see if pressing space actually presses one of those buttons, and if pressing tab moves the highlight focus square between elements in the emulator controls. If that is the problem, then you should be able to work around it as follows:

  • Select the extended controls (The "..." button in the emulator controls)
  • Change to any item in the extended controls window by clicking
  • Close the extended controls window

The focus should now return to the main Android emulator window, not the emulator controls, and key presses should go to Android apps.

1
  • 2
    Thanks for pointing to that issue! I used the mentioned workaround there with a shortcut executing "xterm -e exit" to get the focus back. That is faster then opening and closing the settings menu. Issue seems to be related with the xfce window manager Aug 10 '17 at 7:50
0

Try Ctrl + F11 or NumPad 7. That should enable your keyboard, unless is disabled from somewhere else.

6
  • 4
    i thought Ctrl+F11 was Portrait/Landscape orientation? May 23 '12 at 18:29
  • Yes Ctrl+F11 switch between orientations and not enable the keyboard, same with numpad 7
    – Hafiz
    May 24 '12 at 5:30
  • Yes it does switch between the orientation, but it also brings up the keyboard.
    – slybloty
    May 24 '12 at 13:45
  • @slybloty I am talking about enabling keyboard of my PC in emulator not side keybarod in the emulator
    – Hafiz
    May 24 '12 at 21:18
  • I know it's a burden, but I'd suggest to uninstall and reinstall it, unless you've already done it.
    – slybloty
    Jun 16 '12 at 0:05
0

If you are using Xamarin.Android in Visual Studio 2010, you can enable Keyboard Support as follows:

  1. Close your AVD
  2. In VS2010, go to Tools > Start Android Emulator Manager
  3. Select the AVD Name that you want to add Keyboard Support for, then click the Edit button
  4. In the Hardware area, click the New button
  5. In the Property dropdown, select Keyboard support, then click the OK button
  6. The Keyboard support Property is added to the Hardware list. Change the Value from No to Yes
  7. Click the Edit AVD button

Screenshot of "Edit Android Virtual Device" window

0

As a few have indicated here, the PC keyboard should be enabled for the AVD Emulator instances. Judging by what the emulator page on the Android Developer website says about key commands and such, it does not appear there is a way to enable/disable PC keyboard usage within the SDK. Your best bet is re-installing the SDK, and try again.

1
  • I already have installed newer version of sdk
    – Hafiz
    Jun 24 '12 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.