Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PC keyboard not working in Android emulator [duplicate]

I'm unable to use my PC keyboard to input characters into the app running on AVD emulator even though I had chosen 'Enable keyboard input' when creating the AVD. Can anyone help?

Below is my config.ini.

Note

File directory can be accessed from AVD Manager:

-> click the down arrow on the Actions column

-> Show on Disk.

For GNU/Linux users, with default Android Studio configuration, the file is found under directory /home/<<user>>/.android/avd/<<device>>.avd

config.ini

avd.ini.encoding=UTF-8
AvdId=Nexus_5_API_21
abi.type=x86_64
avd.ini.displayname=Nexus 5 API 21
disk.dataPartition.size=200M
hw.accelerometer=yes
hw.audioInput=yes
hw.battery=yes
hw.camera.back=none
hw.camera.front=none
hw.cpu.arch=x86_64
hw.dPad=no
hw.device.hash2=MD5:2fa0e16c8cceb7d385183284107c0c88
hw.device.manufacturer=Google
hw.device.name=Nexus 5
hw.gps=yes
hw.gpu.enabled=yes
hw.keyboard=yes
hw.lcd.density=480
hw.mainKeys=no
hw.ramSize=1536
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no

image.sysdir.1=system-images/android-21/default/x86_64/
runtime.network.latency=none
runtime.network.speed=full
runtime.scalefactor=0.25
sdcard.path=/Users/xxxxxx/.android/avd/Nexus_5_API_21.avd/sdcard.img
skin.dynamic=yes
skin.name=nexus_5
skin.path=/Applications/Android Studio.app/Contents/plugins/android/lib/device-art-resources/nexus_5
snapshot.present=no
tag.display=Default
tag.id=default
vm.heapSize=64

More info: I'm using Mac OS X 10.10.4 (Yosemite). Android Studio 1.3

like image 753
Dong Nguyen Avatar asked Dec 20 '22 01:12

Dong Nguyen


2 Answers

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.

like image 124
David Fraser Avatar answered Dec 28 '22 06:12

David Fraser


try to change following.

hw.keyboard = yes
hw.keyboard.lid = no
hw.keyboard.charmap = qwerty2
like image 32
OneByte Avatar answered Dec 28 '22 06:12

OneByte