Samsung Galaxy S II AVD (Android Virtual Device) Basic Settings?

Frank Stallone picture Frank Stallone · May 17, 2012 · Viewed 75.8k times · Source

I would like to create an AVD of the Samsung Galaxy S II. The sole purpose is to test websites with it's default web browser to see how they look in both portrait and landscape mode.

As it's now the most popular Android smartphone, I'd like to test it with my websites.

I would just like to know the most basic settings so I can get at least a rough idea. I'm using the Andriod SDK with the GUI frontend.

I'm looking for those settings that come up after you click "New" in the Andriod Virtual Device Manager.

For example:

Target: SD Card: Skin: Hardware: Abstracted LCD Density Max VM application heap size Device RAM size

Etc.

I tried Samsung's online remote test lab but I've found that too restrictive (can't seem to use it at Internet hotspots that have certain ports closed), slow to start and I just end up with blank black screens anyway. So, I'd really prefer to just run my own version as an AVD.

Answer

Lloyd picture Lloyd · Jan 7, 2013

The interface to the AVD manager has changed. So there are changes needed to the process. Rather than a single file, there's now both a device definition and a virtual device definition. Unfortunately, the UI doesn't give full control over the contents of either.

These instructions work with the Android SDK Tools revision 21. They make reference to Windows 7 paths. If you're using a different OS, you'll need to figure out where the files live.

Follow the steps from mwalter up to step 6 (to get the appropriate skins). Then do the following:

  1. Within the Android Virtual Device Manager, click on the Device Definitions tab and press "New Device"

  2. Type the name "Samsung Galaxy SII" (the name must be exact for the following files to work. If you change it, be sure to make the equivalent changes to the names in the following files.)

  3. Fill in the screen size, resolution and RAM. We're going to override the contents, so values don't really matter, but correct ones are: Screen Size: 4.3 Resolution: 480 x 800 RAM: 1024 Density: hdpi Buttons: Hardware

  4. Hit Create Device, then close the AVD Manager

  5. Open the file C:\Users\[user name]\.android\devices.xml in your favorite XML editor

  6. Replace the <d:device>...</d:device> element having the name "Samsung Galaxy SII" with the following:

    <d:device>
      <d:name>Samsung Galaxy SII</d:name>
      <d:manufacturer>Samsung</d:manufacturer>
      <d:meta/>
      <d:hardware>
        <d:screen>
          <d:screen-size>normal</d:screen-size>
          <d:diagonal-length>4.30</d:diagonal-length>
          <d:pixel-density>hdpi</d:pixel-density>
          <d:screen-ratio>long</d:screen-ratio>
          <d:dimensions>
            <d:x-dimension>480</d:x-dimension>
            <d:y-dimension>800</d:y-dimension>
          </d:dimensions>
          <d:xdpi>216.97</d:xdpi>
          <d:ydpi>216.97</d:ydpi>
          <d:touch>
            <d:multitouch>jazz-hands</d:multitouch>
            <d:mechanism>finger</d:mechanism>
            <d:screen-type>capacitive</d:screen-type>
          </d:touch>
        </d:screen>
        <d:networking>
          Bluetooth
          <!--NFC (put this back in if you have an S2 model that supports NFC-->
          Wifi
        </d:networking>
        <d:sensors>
          Compass
          Accelerometer
          GPS
          ProximitySensor
          LightSensor
          Gyroscope
        </d:sensors>
        <d:mic>true</d:mic>
        <d:camera>
          <d:location>back</d:location>
          <d:autofocus>true</d:autofocus>
          <d:flash>true</d:flash>
        </d:camera>
        <d:keyboard>nokeys</d:keyboard>
        <d:nav>nonav</d:nav>
        <d:ram unit="GiB">1</d:ram>
        <d:buttons>hard</d:buttons>
        <d:internal-storage unit="GiB">16</d:internal-storage>
        <d:removable-storage unit="GiB">32</d:removable-storage>
        <d:cpu>Generic CPU</d:cpu>
        <d:gpu>Generic GPU</d:gpu>
        <d:abi>
          armeabi-v7a
          armeabi
        </d:abi>
        <d:dock/>
        <d:power-type>battery</d:power-type>
      </d:hardware>
      <d:software>
        <d:api-level>10-</d:api-level>
        <d:live-wallpaper-support>true</d:live-wallpaper-support>
        <d:bluetooth-profiles>
          HSP
          HFP
          A2DP
          AVRCP
          OPP
          PBAP
          HID
        </d:bluetooth-profiles>
        <d:gl-version>2.0</d:gl-version>
        <d:gl-extensions>
          <!-- No clue why the tool is unhappy declaring these, but it is.  (Doesn't complain about their presence in the 'official' devices.)  Comment them out for now.
          GL_OES_rgb8_rgba8
          GL_OES_depth24
          GL_OES_vertex_half_float
          GL_OES_texture_float
          GL_OES_texture_half_float
          GL_OES_element_index_uint
          GL_OES_mapbuffer
          GL_OES_fragment_precision_high
          GL_OES_compressed_ETC1_RGB8_texture
          GL_OES_EGL_image
          GL_OES_EGL_image_external
          GL_OES_required_internalformat
          GL_OES_depth_texture
          GL_OES_get_program_binary
          GL_OES_packed_depth_stencil
          GL_OES_standard_derivatives
          GL_OES_vertex_array_object
          GL_OES_egl_sync
          GL_EXT_multi_draw_arrays
          GL_EXT_texture_format_BGRA8888
          GL_EXT_discard_framebuffer
          GL_EXT_shader_texture_lod
          GL_IMG_shader_binary
          GL_IMG_texture_compression_pvrtc
          GL_IMG_texture_npot
          GL_IMG_texture_format_BGRA8888
          GL_IMG_read_format
          GL_IMG_program_binary
          GL_IMG_multisampled_render_to_texture
          -->
        </d:gl-extensions>
        <d:status-bar>true</d:status-bar>
      </d:software>
      <d:state default="true" name="Portrait">
        <d:description>The device in portrait orientation</d:description>
        <d:screen-orientation>port</d:screen-orientation>
        <d:keyboard-state>keyssoft</d:keyboard-state>
        <d:nav-state>nonav</d:nav-state>
      </d:state>
      <d:state name="Landscape">
        <d:description>The device in landscape orientation</d:description>
        <d:screen-orientation>land</d:screen-orientation>
        <d:keyboard-state>keyssoft</d:keyboard-state>
        <d:nav-state>nonav</d:nav-state>
      </d:state>
    </d:device>
    
  7. Re-open the AVD Manager and go back to the Device Definitions tab, select the Samsung Galaxy SII device and select Create AVD. Name it as you see fit and hit "ok". (Again, we're going to override this, so don't worry about the settings too much.)

  8. Close the AVD Manager and open the file C:\Users\[user name]\.android\avd\[avd name]\config.ini in your favorite text editor

  9. Replace the contents of the file with the following:

    avd.ini.encoding=ISO-8859-1
    abi.type=armeabi
    hw.accelerometer=yes
    hw.audioInput=yes
    hw.battery=yes
    hw.cpu.arch=arm
    hw.device.hash=-1902399403
    hw.device.manufacturer=Samsung
    hw.device.name=Samsung Galaxy SII
    hw.dPad=no
    hw.gps=yes
    hw.gsmModem=yes
    hw.keyboard=no
    hw.lcd.density=240
    hw.mainKeys=yes
    hw.ramSize=1024M
    hw.sdCard=yes
    hw.sensors.orientation=yes
    hw.sensors.proximity=yes
    hw.touchScreen=yes
    hw.trackBall=no
    image.sysdir.1=platforms\android-10\images\
    skin.dynamic=yes
    skin.name=galaxy_s2
    skin.path=platforms\android-10\skins\GALAXY_S2
    vm.heapSize=32
    disk.dataPartition.size=2G
    hw.camera.back=webcam0
    sdcard.size=200M
    
  10. You may want to edit the last 3 entries to change how much storage is available and how/whether the camera is changed. I've found that if I make the disk.dataPartition.size as big as it ought to be (16G), the simulator doesn't start properly. The same for sdcard.size, which can be as big as 32G. The hw.camera.back can be set to "None" or "Emulated" if you prefer. As well, check that the hw.device.hash value is the same as in the original file. If it's different, the file won't work.

Good luck.