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:
- 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).
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
- 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.)
- 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).
Android Virtual Device (AVD) definition (finally)
Relaunch the AVD Manager
- Select the Device Definition you just created
- Click Create AVD...
or
- Click Create... on the Virtual Devices tab
- Select the definition you created under Device
then
- Accept all defaults unless noted otherwise
- AVD Name: AVD_for_Samsung_Galaxy_SII (or whatever)
- Device: already set to your device definition's name
- Target: choose the appropriate API level- I usually append this to the AVD Name at this point too
- CPU/ABI: ARM
- Keyboard: Uncheck/Disable 'Hardware keyboard present'
- Skin: Galaxy_S2 (if you extracted skin under the chosen target API)
- Back Camera: Webcam0 (or whatever; are you interacting with it?)
- RAM: Consider lowering to 768 if on Windows
- Internal Storage: Although the SII came in 16GB and 32GB varieties, consider leaving at 200MiB.
- 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:
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.