三星Galaxy S II AVD (Android虚拟设备)基本设置?

时间:2022-07-16 18:54:35

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.

我想创造一个三星Galaxy S II的AVD。唯一的目的是用默认的web浏览器测试网站,看看它们在纵向和横向模式下的外观。

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

由于它是目前最流行的Android智能手机,我想用我的网站来测试它。

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.

我只想知道最基本的设置,这样我至少能得到一个粗略的想法。我正在使用Andriod SDK和GUI前端。

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

我正在寻找在Andriod虚拟设备管理器中单击“New”后出现的那些设置。

For example:

例如:

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

目标:SD卡:Skin:硬件:抽象的LCD密度最大VM应用程序堆大小设备RAM大小

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.

我尝试了三星的在线远程测试实验室,但我发现这个实验室太严格了(似乎不能在某些端口关闭的互联网热点上使用它),启动速度很慢,而且我最终还是只能看到黑屏。所以,我更喜欢用AVD运行我自己的版本。

6 个解决方案

#1


53  

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.

AVD管理器的接口已经更改。所以这个过程需要改变。与单个文件相比,现在有了设备定义和虚拟设备定义。不幸的是,UI不能完全控制这两种类型的内容。

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.

这些说明使用Android SDK工具修改21。它们引用了Windows 7的路径。如果您使用的是不同的操作系统,那么您需要确定文件的位置。

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

按照从mwalter到步骤6的步骤(获得适当的皮肤)。然后执行以下操作:

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

    在Android虚拟设备管理器中,单击设备定义选项卡并按“新设备”

  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.)

    键入“三星Galaxy SII”(该名称必须与以下文件对应)。如果您更改了它,请确保对以下文件中的名称进行相同的更改。

  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

    填写屏幕大小、分辨率和RAM。我们将重写内容,所以值并不重要,但是正确的值是:屏幕大小:4.3分辨率:480 x 800 RAM: 1024密度:hdpi按钮:硬件

  4. Hit Create Device, then close the AVD Manager

    点击创建设备,然后关闭AVD管理器

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

    打开文件C:\Users\【用户名】\ .android \设备。您最喜欢的xml编辑器中的xml

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

    替换< d:设备>…元素,名称为“三星Galaxy SII”,内容如下:

    <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.)

    重新打开AVD管理器,回到设备定义选项卡,选择三星Galaxy SII设备,选择Create AVD。按你认为合适的名字命名,点击“确定”。(同样,我们要重写这个,所以不要太担心设置。)

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

    关闭AVD管理器,打开文件C:\Users\ \[用户名)。安卓\ avd \[avd名称]\配置。ini在您最喜欢的文本编辑器中。

  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.

    您可能希望编辑最后3个条目,以更改可用的存储空间以及如何/是否更改摄像机。我发现如果我制作磁盘。datapartition。尽管大小应该是(16G),模拟器并没有正常启动。对sdcard一样。尺寸,可以是32克。hw.camera。如果您愿意,可以将back设置为“None”或“仿真”。同样,检查hw.device.hash值是否与原始文件相同。如果它是不同的,文件就不能工作。

Good luck.

祝你好运。

#2


32  

Do the following to create the Samsung Galaxy S2 skin:

制作三星Galaxy S2皮肤如下:

  1. Download the skin from the Samsung page (follow the link posted by anshumans)
  2. 从三星页面下载皮肤(按照anshumans发布的链接)
  3. Go to directory [Android-SDK directory]/platforms/android-10/skins
  4. 进入目录[Android-SDK目录]/平台/android-10/皮肤
  5. Create a new directory named GALAXY_S2
  6. 创建一个名为GALAXY_S2的新目录
  7. Extract all files from the downloaded ZIP file to the new directory
  8. 从下载的ZIP文件中提取所有文件到新目录
  9. Edit the file manifest.ini and change the line api=9 to api=10
  10. 编辑该文件清单。将line api=9改为api=10
  11. Start the AVD and click "New..."
  12. 启动AVD并单击“New…”
  13. Under Target select "Android 2.3.3 - API Level 10"
  14. 在目标下选择“Android 2.3.3 - API级别10”
  15. Under Skin choose "GALAXY_S2" from the dropdown list
  16. 在皮肤下面从下拉列表中选择“galaxy s2”
  17. Click "Create AVD"
  18. 点击“建立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.

您可能已经注意到AVD将基于Android API 10级别。所以如果你选择目标Android API等级16,Galaxy S2皮肤就不会出现。

#3


16  

Samsung has the S II skin on their developer site here

三星在他们的开发者网站上有S - II皮肤

#4


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=

您可以从三星的dev网站http://developer.samsung.com/technical-doc/view.do?

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

还有关于如何使用它们的详细说明——http://developer.samsung.com/technical-doc/view.do?

#5


0  

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:

它位于硬件中。你的AVD皮肤。你可以在这里找到:

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

from 300 to 218.

从300年到218年。

#6


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

我不喜欢盲目复制粘贴;同样,上面的答案提到了第二个答案,而第二个答案又提到了第三个;最后,SDK工具v24.1.2中有一些新的更改,这意味着如果不测试蓝牙,则绝对不需要进行文件编辑。因此,我认为我应该发布一个更新的和统一的解决方案。感谢anshumans, mwalter, Lloyd和评论人

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:

路径使用Windows约定。OS X/Linux用户通常只需要切换回斜杠(\)来转发斜杠(/),安装文件夹除外。这些环境变量可以在您的系统上设置,也可以不设置:

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

是AVD管理器的位置。exe(默认为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 :)])

是AVD用来存储设备定义的.android文件夹的位置(默认为主页[与SDK的位置无关])


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).

三星的开发者网站包含许多皮肤的链接,包括S2;它还提供了使用Eclipse和ADT插件安装它们的说明,这是不必要的,Android Studio已经取代了它。要获得S2皮肤,请使用三星页面上的链接,然后单击带有软盘符号的Zip文件(或单击此处)。

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

如果您没有使用三星的说明来安装Eclipse,程序是:

  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. 确定你的目标是哪个版本的Android。注意,S2在API级别9(姜饼)上发布,皮肤反映了这一点。后来的版本和更新包括API级别10、15和16。(根据*)。
  3. 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

    在哪里? ?您在上面步骤1中选择的目标是否将下载的zip文件的内容提取到一个新文件夹(例如,galaxy s2)

      <ADT_HOME>\platforms\android-??\skins
    
  4. 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.)
  5. 编辑提取的清单。ini更改了line api=9以反映其当前位置(例如api=15)。(这似乎并不是必要的,但在我确认之前,我们先不谈。)
  6. Repeat steps 1-3 for each release you wish to test against.
  7. 对您希望测试的每个版本重复步骤1-3。

Device Definition

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

选择AVD管理器上的设备定义选项卡,然后单击Create Device…按钮。在新建设备屏幕上,

  • Accept all defaults except where noted
  • 接受所有的默认值,除非注意到。
  • Name: Samsung Galaxy SII (or whatever)
  • 名称:三星Galaxy SII(或其他)
  • Screen Size: 4.3 (or 4.5 for I9210 model)
  • 屏幕尺寸:4.3(或I9210模型4.5)
  • Resolution: 480x800
  • 分辨率:480 x800
  • RAM: 1024 MiB (or 1 GiB)
  • RAM: 1024 MiB(或1 GiB)
  • Density: hdpi
  • 密度:hdpi
  • Buttons: Hardware
  • 按钮:硬件
  • Click on Create Device
  • 点击创建设备

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

< ANDROID_SDK_HOME > \ .android \设备。新的设备定义将更新xml。

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).

一般来说,除非您正在基于它创建大量的avd,否则您不必手工编辑devices.xml中的条目。还请注意,许多为匹配SII硬件而提出的编辑实际上没有最终结果。如果您希望编辑,请首先关闭AVD管理器(如果适用的话,关闭Eclipse IDE)。

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

    找到您刚刚创建的d:device的节点:名称为>三星Galaxy SII

    • d:manufacturer (optional) change value from User to Samsung
    • d:制造商(可选)将用户的价值变更为三星
    • d:networking (optional) delete/comment out NFC (e.g. <!-- NFC -->) unless you want to test against the rare models that included it
    • 网络(可选)删除/注释NFC(如 )除非你想对包含它的罕见模型进行测试
    • d:sensors delete Barometer line
    • d:传感器删除线晴雨表
    • d:internal-storage (optional) change value from 4 to 16 (or 32), but it is ignored anyways when creating the AVD
    • d:内部存储(可选)将值从4更改为16(或32),但是在创建AVD时无论如何都忽略它
    • d:removable-storage no need to add this, as it is ignored
    • d:可移动存储不需要添加这个,因为它被忽略了
    • d:abi no need to pare this, as it is ignored
    • 艾比不需要削减,因为它被忽略了。
    • d:bluetooth-profiles replace self-closing tag with

      d:bluetooth-profiles替换自闭标签。

      <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'
    • d:导航状态将两个条目(在竖屏和横屏下)都更改为“nonav”

Android Virtual Device (AVD) definition (finally)

Relaunch the AVD Manager

重启的AVD管理器

  1. Select the Device Definition you just created
  2. 选择刚刚创建的设备定义
  3. Click Create AVD...
  4. 点击创建AVD……

or

  1. Click Create... on the Virtual Devices tab
  2. 单击Create……在虚拟设备选项卡上
  3. Select the definition you created under Device
  4. 选择在设备下创建的定义

then

然后

  1. Accept all defaults unless noted otherwise
  2. 接受所有违约,除非另有说明
  3. AVD Name: AVD_for_Samsung_Galaxy_SII (or whatever)
  4. AVD名称:AVD_for_Samsung_Galaxy_SII(或其他)
  5. Device: already set to your device definition's name
  6. 设备:已设置为设备定义的名称
  7. Target: choose the appropriate API level- I usually append this to the AVD Name at this point too
  8. 目标:选择适当的API级别——我通常也会在此时将其附加到AVD名称中
  9. CPU/ABI: ARM
  10. CPU / ABI:手臂
  11. Keyboard: Uncheck/Disable 'Hardware keyboard present'
  12. 键盘:Uncheck/禁用“硬件键盘”
  13. Skin: Galaxy_S2 (if you extracted skin under the chosen target API)
  14. 皮肤:galaxy s2(如果在选定的目标API下提取皮肤)
  15. Back Camera: Webcam0 (or whatever; are you interacting with it?)
  16. 后置摄像头:Webcam0(或其他;你和它互动吗?)
  17. RAM: Consider lowering to 768 if on Windows
  18. RAM:如果是在Windows上,可以考虑降低到768
  19. Internal Storage: Although the SII came in 16GB and 32GB varieties, consider leaving at 200MiB.
  20. 内部存储:尽管SII有16GB和32GB两种,但可以考虑在200MiB。
  21. SD Card Size: leave blank unless it's part of your testing. The larger it is, the more resources required. (Consider 200MiB)
  22. SD卡大小:除非它是测试的一部分,否则留空。它越大,需要的资源就越多。(考虑200 mib)

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

要在Windows上实现更快的仿真,请考虑在Windows特性中禁用HyperV并启用HAXM。如果你这样做了,改变以下几点:

  1. CPU/ABI: Choose any Intel

    CPU / ABI:选择任何英特尔

    Emulation: Check/Enable 'Use Host GPU'

    仿真:检查/启用“使用主机GPU”

Click OK.

单击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.

< ANDROID_SDK_HOME > \ avd \ < AVD_NAME > .avd \配置。ini反映了上面的所有设置(其中AVD_NAME是您在4中设置的)。lloyd给出的示例只显示了皮肤的一个不同之处。dynamic=yes—我在运行时看不到区别。

#1


53  

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.

AVD管理器的接口已经更改。所以这个过程需要改变。与单个文件相比,现在有了设备定义和虚拟设备定义。不幸的是,UI不能完全控制这两种类型的内容。

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.

这些说明使用Android SDK工具修改21。它们引用了Windows 7的路径。如果您使用的是不同的操作系统,那么您需要确定文件的位置。

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

按照从mwalter到步骤6的步骤(获得适当的皮肤)。然后执行以下操作:

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

    在Android虚拟设备管理器中,单击设备定义选项卡并按“新设备”

  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.)

    键入“三星Galaxy SII”(该名称必须与以下文件对应)。如果您更改了它,请确保对以下文件中的名称进行相同的更改。

  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

    填写屏幕大小、分辨率和RAM。我们将重写内容,所以值并不重要,但是正确的值是:屏幕大小:4.3分辨率:480 x 800 RAM: 1024密度:hdpi按钮:硬件

  4. Hit Create Device, then close the AVD Manager

    点击创建设备,然后关闭AVD管理器

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

    打开文件C:\Users\【用户名】\ .android \设备。您最喜欢的xml编辑器中的xml

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

    替换< d:设备>…元素,名称为“三星Galaxy SII”,内容如下:

    <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.)

    重新打开AVD管理器,回到设备定义选项卡,选择三星Galaxy SII设备,选择Create AVD。按你认为合适的名字命名,点击“确定”。(同样,我们要重写这个,所以不要太担心设置。)

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

    关闭AVD管理器,打开文件C:\Users\ \[用户名)。安卓\ avd \[avd名称]\配置。ini在您最喜欢的文本编辑器中。

  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.

    您可能希望编辑最后3个条目,以更改可用的存储空间以及如何/是否更改摄像机。我发现如果我制作磁盘。datapartition。尽管大小应该是(16G),模拟器并没有正常启动。对sdcard一样。尺寸,可以是32克。hw.camera。如果您愿意,可以将back设置为“None”或“仿真”。同样,检查hw.device.hash值是否与原始文件相同。如果它是不同的,文件就不能工作。

Good luck.

祝你好运。

#2


32  

Do the following to create the Samsung Galaxy S2 skin:

制作三星Galaxy S2皮肤如下:

  1. Download the skin from the Samsung page (follow the link posted by anshumans)
  2. 从三星页面下载皮肤(按照anshumans发布的链接)
  3. Go to directory [Android-SDK directory]/platforms/android-10/skins
  4. 进入目录[Android-SDK目录]/平台/android-10/皮肤
  5. Create a new directory named GALAXY_S2
  6. 创建一个名为GALAXY_S2的新目录
  7. Extract all files from the downloaded ZIP file to the new directory
  8. 从下载的ZIP文件中提取所有文件到新目录
  9. Edit the file manifest.ini and change the line api=9 to api=10
  10. 编辑该文件清单。将line api=9改为api=10
  11. Start the AVD and click "New..."
  12. 启动AVD并单击“New…”
  13. Under Target select "Android 2.3.3 - API Level 10"
  14. 在目标下选择“Android 2.3.3 - API级别10”
  15. Under Skin choose "GALAXY_S2" from the dropdown list
  16. 在皮肤下面从下拉列表中选择“galaxy s2”
  17. Click "Create AVD"
  18. 点击“建立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.

您可能已经注意到AVD将基于Android API 10级别。所以如果你选择目标Android API等级16,Galaxy S2皮肤就不会出现。

#3


16  

Samsung has the S II skin on their developer site here

三星在他们的开发者网站上有S - II皮肤

#4


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=

您可以从三星的dev网站http://developer.samsung.com/technical-doc/view.do?

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

还有关于如何使用它们的详细说明——http://developer.samsung.com/technical-doc/view.do?

#5


0  

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:

它位于硬件中。你的AVD皮肤。你可以在这里找到:

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

from 300 to 218.

从300年到218年。

#6


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

我不喜欢盲目复制粘贴;同样,上面的答案提到了第二个答案,而第二个答案又提到了第三个;最后,SDK工具v24.1.2中有一些新的更改,这意味着如果不测试蓝牙,则绝对不需要进行文件编辑。因此,我认为我应该发布一个更新的和统一的解决方案。感谢anshumans, mwalter, Lloyd和评论人

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:

路径使用Windows约定。OS X/Linux用户通常只需要切换回斜杠(\)来转发斜杠(/),安装文件夹除外。这些环境变量可以在您的系统上设置,也可以不设置:

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

是AVD管理器的位置。exe(默认为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 :)])

是AVD用来存储设备定义的.android文件夹的位置(默认为主页[与SDK的位置无关])


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).

三星的开发者网站包含许多皮肤的链接,包括S2;它还提供了使用Eclipse和ADT插件安装它们的说明,这是不必要的,Android Studio已经取代了它。要获得S2皮肤,请使用三星页面上的链接,然后单击带有软盘符号的Zip文件(或单击此处)。

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

如果您没有使用三星的说明来安装Eclipse,程序是:

  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. 确定你的目标是哪个版本的Android。注意,S2在API级别9(姜饼)上发布,皮肤反映了这一点。后来的版本和更新包括API级别10、15和16。(根据*)。
  3. 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

    在哪里? ?您在上面步骤1中选择的目标是否将下载的zip文件的内容提取到一个新文件夹(例如,galaxy s2)

      <ADT_HOME>\platforms\android-??\skins
    
  4. 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.)
  5. 编辑提取的清单。ini更改了line api=9以反映其当前位置(例如api=15)。(这似乎并不是必要的,但在我确认之前,我们先不谈。)
  6. Repeat steps 1-3 for each release you wish to test against.
  7. 对您希望测试的每个版本重复步骤1-3。

Device Definition

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

选择AVD管理器上的设备定义选项卡,然后单击Create Device…按钮。在新建设备屏幕上,

  • Accept all defaults except where noted
  • 接受所有的默认值,除非注意到。
  • Name: Samsung Galaxy SII (or whatever)
  • 名称:三星Galaxy SII(或其他)
  • Screen Size: 4.3 (or 4.5 for I9210 model)
  • 屏幕尺寸:4.3(或I9210模型4.5)
  • Resolution: 480x800
  • 分辨率:480 x800
  • RAM: 1024 MiB (or 1 GiB)
  • RAM: 1024 MiB(或1 GiB)
  • Density: hdpi
  • 密度:hdpi
  • Buttons: Hardware
  • 按钮:硬件
  • Click on Create Device
  • 点击创建设备

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

< ANDROID_SDK_HOME > \ .android \设备。新的设备定义将更新xml。

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).

一般来说,除非您正在基于它创建大量的avd,否则您不必手工编辑devices.xml中的条目。还请注意,许多为匹配SII硬件而提出的编辑实际上没有最终结果。如果您希望编辑,请首先关闭AVD管理器(如果适用的话,关闭Eclipse IDE)。

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

    找到您刚刚创建的d:device的节点:名称为>三星Galaxy SII

    • d:manufacturer (optional) change value from User to Samsung
    • d:制造商(可选)将用户的价值变更为三星
    • d:networking (optional) delete/comment out NFC (e.g. <!-- NFC -->) unless you want to test against the rare models that included it
    • 网络(可选)删除/注释NFC(如 )除非你想对包含它的罕见模型进行测试
    • d:sensors delete Barometer line
    • d:传感器删除线晴雨表
    • d:internal-storage (optional) change value from 4 to 16 (or 32), but it is ignored anyways when creating the AVD
    • d:内部存储(可选)将值从4更改为16(或32),但是在创建AVD时无论如何都忽略它
    • d:removable-storage no need to add this, as it is ignored
    • d:可移动存储不需要添加这个,因为它被忽略了
    • d:abi no need to pare this, as it is ignored
    • 艾比不需要削减,因为它被忽略了。
    • d:bluetooth-profiles replace self-closing tag with

      d:bluetooth-profiles替换自闭标签。

      <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'
    • d:导航状态将两个条目(在竖屏和横屏下)都更改为“nonav”

Android Virtual Device (AVD) definition (finally)

Relaunch the AVD Manager

重启的AVD管理器

  1. Select the Device Definition you just created
  2. 选择刚刚创建的设备定义
  3. Click Create AVD...
  4. 点击创建AVD……

or

  1. Click Create... on the Virtual Devices tab
  2. 单击Create……在虚拟设备选项卡上
  3. Select the definition you created under Device
  4. 选择在设备下创建的定义

then

然后

  1. Accept all defaults unless noted otherwise
  2. 接受所有违约,除非另有说明
  3. AVD Name: AVD_for_Samsung_Galaxy_SII (or whatever)
  4. AVD名称:AVD_for_Samsung_Galaxy_SII(或其他)
  5. Device: already set to your device definition's name
  6. 设备:已设置为设备定义的名称
  7. Target: choose the appropriate API level- I usually append this to the AVD Name at this point too
  8. 目标:选择适当的API级别——我通常也会在此时将其附加到AVD名称中
  9. CPU/ABI: ARM
  10. CPU / ABI:手臂
  11. Keyboard: Uncheck/Disable 'Hardware keyboard present'
  12. 键盘:Uncheck/禁用“硬件键盘”
  13. Skin: Galaxy_S2 (if you extracted skin under the chosen target API)
  14. 皮肤:galaxy s2(如果在选定的目标API下提取皮肤)
  15. Back Camera: Webcam0 (or whatever; are you interacting with it?)
  16. 后置摄像头:Webcam0(或其他;你和它互动吗?)
  17. RAM: Consider lowering to 768 if on Windows
  18. RAM:如果是在Windows上,可以考虑降低到768
  19. Internal Storage: Although the SII came in 16GB and 32GB varieties, consider leaving at 200MiB.
  20. 内部存储:尽管SII有16GB和32GB两种,但可以考虑在200MiB。
  21. SD Card Size: leave blank unless it's part of your testing. The larger it is, the more resources required. (Consider 200MiB)
  22. SD卡大小:除非它是测试的一部分,否则留空。它越大,需要的资源就越多。(考虑200 mib)

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

要在Windows上实现更快的仿真,请考虑在Windows特性中禁用HyperV并启用HAXM。如果你这样做了,改变以下几点:

  1. CPU/ABI: Choose any Intel

    CPU / ABI:选择任何英特尔

    Emulation: Check/Enable 'Use Host GPU'

    仿真:检查/启用“使用主机GPU”

Click OK.

单击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.

< ANDROID_SDK_HOME > \ avd \ < AVD_NAME > .avd \配置。ini反映了上面的所有设置(其中AVD_NAME是您在4中设置的)。lloyd给出的示例只显示了皮肤的一个不同之处。dynamic=yes—我在运行时看不到区别。