Thursday, December 13, 2012

Android Virtual Devices (AVD) Problem on Ubuntu 12.04

While creating a new AVD for an Android 4.0.3 (Ice Cream Sandwich) device, I discovered several peculiarities in the emulator. Upon starting the newly created AVD, it displayed a message ("Unfortunately, System UI has stopped") as shown in the figure below.


        Error message

Upon clicking OK, the emulator displayed the login screen after a brief red flash along the borders. Then I noticed that the hardware buttons (second row of buttons) and the DPAD has not been enabled (see figure below with the messages pointed by the yellow arrows).


        Not enabled items

Upon doing some research on the internet, I found the solution to this problem. To reiterate the solution:

  1. Open a terminal and then edit the AVD config file by executing:

      nano .android/avd/(avdname).avd/config.ini

    NOTE: Replace the (avdname) with the name used when creating the AVD.

    The file would look something like this:

    ---------------------------------------------------
    hw.dPad=no
    hw.lcd.density=160
    sdcard.size=128M
    hw.cpu.arch=arm
    hw.device.hash=-1537072293
    disk.dataPartition.size=200M
    hw.gpu.enabled=yes
    skin.path=1024x600
    skin.dynamic=yes
    hw.keyboard=yes
    hw.cpu.model=cortex-a8
    hw.ramSize=768
    hw.device.manufacturer=Generic
    hw.sdCard=yes
    hw.mainKeys=no
    hw.accelerometer=yes
    skin.name=1024x600
    abi.type=armeabi-v7a
    hw.trackBall=no
    hw.device.name=7in WSVGA (Tablet)
    hw.battery=yes
    hw.sensors.proximity=yes
    image.sysdir.1=system-images/android-15/armeabi-v7a/
    hw.sensors.orientation=yes
    hw.audioInput=yes
    hw.camera.front=webcam0
    hw.gps=yes
    vm.heapSize=16
    ------------------------------------------------------
     
  2. Notice that the 'hw.dPad' and 'hw.mainKeys' have both been set to 'no' - i.e., they are disabled. Change both items to 'yes' so that they are enabled. They should look like this:

    hw.dPad=yes
    hw.mainKeys=yes


    Save the changes and exit the editor and terminal.
Start the AVD again - this time, you should not see any error messages upon startup and both the hardware buttons and DPAD has been enabled. You can check it out by playing around with AVD and using these keys.

6 comments:

  1. Thank you! This worked for me. Spent a lot of time looking for this solution. You are the man.

    ReplyDelete
  2. Thank you, it was completely unclear in other posts I found regarding this issue.

    ReplyDelete
  3. this solution won't work for me can you suggest another one

    ReplyDelete