42

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.

Neil
  • 7,861
  • 4
  • 53
  • 74
Frank Stallone
  • 451
  • 1
  • 5
  • 5
  • I hope I worded this question correctly. Seeing that there's no response, I'm worried that I've submitted this question incorrectly. – Frank Stallone May 18 '12 at 22:40

6 Answers6

54

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.

Lloyd
  • 541
  • 4
  • 2
  • 4
    For Mac you need change "\" to "/". – Tomáš Linhart Jun 21 '13 at 10:37
  • 1
    If you started the AVD manager from Eclipse, you must not only close AVD manager when indicated but also close Eclipse IDE in order to changes to files take effect. In [ADT Bundle (Eclipse + Android SDK)](http://developer.android.com/sdk/installing/bundle.html), AVD Manager has no standalone shortcut so it must be started from ADT IDE instead. – Francisco Alvarado Jul 23 '13 at 22:23
32

Do the following to create the Samsung Galaxy S2 skin:

  1. Download the skin from the Samsung page (follow the link posted by anshumans)
  2. Go to directory [Android-SDK directory]/platforms/android-10/skins
  3. Create a new directory named GALAXY_S2
  4. Extract all files from the downloaded ZIP file to the new directory
  5. Edit the file manifest.ini and change the line api=9 to api=10
  6. Start the AVD and click "New..."
  7. Under Target select "Android 2.3.3 - API Level 10"
  8. Under Skin choose "GALAXY_S2" from the dropdown list
  9. Click "Create AVD"

As you may have noticed the AVD will be based upon the Android API 10 level. So the Galaxy S2 skin won't show up if you choose the target Android API level 16 for example.

mwalter
  • 1,003
  • 2
  • 13
  • 31
16

Samsung has the S II skin on their developer site here

anshumans
  • 4,045
  • 2
  • 18
  • 25
  • I can't seem to get anything to download when I select the Galaxy links. Is the Samsung site borken? It seems to complain about my version of web browser - I've tried w/ the latest FireFox and IE. I thought that maybe I need to sign up with Samsung but I can't even seem to find a way to do that. – IAbstract Dec 07 '14 at 21:56
1

While the top-voted answer is correct, you'll most likely end up having a resolution display problem which will hurt almost any App you'll want to test/develop.

In order to solve that specific issue you also need to change this settings:

hw.lcd.density

which is located in the hardware.ini of your AVD skin. You can find it here:

<ANDROID_SDK_PATH>\sdk\platforms\android-<APIversion>\skins\<YourSkin>\hardware.ini

from 300 to 218.

Darkseal
  • 9,205
  • 8
  • 78
  • 111
1

You can download and add the s2 emulator from Samsung's dev site, http://developer.samsung.com/technical-doc/view.do?v=T000000075&pi=1&ps=10&pb=Y&ct=CT350000&sc=

there is also a detailed instruction on how to use them - http://developer.samsung.com/technical-doc/view.do?v=T000000095

cainstir
  • 11
  • 1
0

I'm not a big fan of blind copy-and-paste; also, the top answer references a 2nd which, in turn, references a 3rd; finally, there are some new changes in SDK Tools v24.1.2 which mean that absolutely no file editing is required if you are not testing BlueTooth. Hence, I thought I'd post an updated and consolidated solution. Full credit to anshumans, mwalter, Lloyd and the commenters

Paths use Windows conventions. OS X/Linux users can often just switch backslashes (\) to forward slashes (/), except for install folders. These environment variables may or may not be set on your system:

<ADT_HOME> is the location of AVD Manager.exe (and defaults to C:\Program Files (x86)\Android\android-sdk)

<ANDROID_SDK_HOME> is the location of the .android folder that AVD uses to store device definitions (and defaults to HOMEPATH [and is unrelated to your SDK's location :)])


Samsung skins

Samsung's developer's site contains links to a number of skins including the S2; it also has instructions for installing them using Eclipse with the ADT Plugin, which is unnecessary and superseded by Android Studio. To just get the S2 skin, use the link on the Samsung page and then click on the Zip file with a floppy disk symbol (or just click here).

If you didn't use Samsung's instructions for installing with Eclipse, the procedure is:

  1. Decide which version of Android you are targeting. Note that the S2 was released on API level 9 (Gingerbread) and the skin reflects this. Later releases and updates included API levels 10, 15 and 16. (as per Wikipedia).
  2. Where ?? is the target you selected in step 1 above, extract the contents of the downloaded zip file to a new folder (e.g. Galaxy_S2) under

      <ADT_HOME>\platforms\android-??\skins
    
  3. Edit the extracted manifest.ini, changing the line api=9 to reflect it's current location (e.g. api=15). (This doesn't actually seem to be necessary, but left in until I can confirm.)
  4. Repeat steps 1-3 for each release you wish to test against.

Device Definition

Select the Device Definitions tab on the AVD Manager and then click Create Device... button. On the Create New Device screen,

  • Accept all defaults except where noted
  • Name: Samsung Galaxy SII (or whatever)
  • Screen Size: 4.3 (or 4.5 for I9210 model)
  • Resolution: 480x800
  • RAM: 1024 MiB (or 1 GiB)
  • Density: hdpi
  • Buttons: Hardware
  • Click on Create Device

<ANDROID_SDK_HOME>\.android\devices.xml will get updated with your new device definition.

As a general rule, unless you are creating a lot of AVDs based on it, you don't ever have to manually edit entries in devices.xml. Note also that many of edits proposed to match the SII's hardware actually have no net result. If you do wish to edit, first close the AVD Manager (and the Eclipse IDE if applicable).

  • Find the node for the d:device you just created with <d:name>Samsung Galaxy SII</d:name>

    • d:manufacturer (optional) change value from User to Samsung
    • d:networking (optional) delete/comment out NFC (e.g. <!-- NFC -->) unless you want to test against the rare models that included it
    • d:sensors delete Barometer line
    • d:internal-storage (optional) change value from 4 to 16 (or 32), but it is ignored anyways when creating the AVD
    • d:removable-storage no need to add this, as it is ignored
    • d:abi no need to pare this, as it is ignored
    • d:bluetooth-profiles replace self-closing tag with

      <d:bluetooth-profiles>
          HSP
          HFP
          A2DP
          AVRCP
          OPP
          PBAP
          HID
      </d:bluetooth-profiles>
      
    • d:status-bar change value to true

    • d:nav-state change both entries (under Portrait and Landscape) to 'nonav'

Android Virtual Device (AVD) definition (finally)

Relaunch the AVD Manager

  1. Select the Device Definition you just created
  2. Click Create AVD...

or

  1. Click Create... on the Virtual Devices tab
  2. Select the definition you created under Device

then

  1. Accept all defaults unless noted otherwise
  2. AVD Name: AVD_for_Samsung_Galaxy_SII (or whatever)
  3. Device: already set to your device definition's name
  4. Target: choose the appropriate API level- I usually append this to the AVD Name at this point too
  5. CPU/ABI: ARM
  6. Keyboard: Uncheck/Disable 'Hardware keyboard present'
  7. Skin: Galaxy_S2 (if you extracted skin under the chosen target API)
  8. Back Camera: Webcam0 (or whatever; are you interacting with it?)
  9. RAM: Consider lowering to 768 if on Windows
  10. Internal Storage: Although the SII came in 16GB and 32GB varieties, consider leaving at 200MiB.
  11. SD Card Size: leave blank unless it's part of your testing. The larger it is, the more resources required. (Consider 200MiB)

For faster emulation on Windows consider disabling HyperV in Windows Features and enabling HAXM. If you do, change the following:

  1. CPU/ABI: Choose any Intel

    Emulation: Check/Enable 'Use Host GPU'

Click OK.

<ANDROID_SDK_HOME>\avd\<AVD_NAME>.avd\config.ini reflects all of your settings above (where AVD_NAME is what you set in 4.). The example given by lloyd only shows one difference where skin.dynamic=yes - I cannot see a difference when running though.

Community
  • 1
  • 1
Frank
  • 899
  • 1
  • 8
  • 13