Android 模拟器与真实设备

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1115413/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:43:14  来源:igfitidea点击:

Android Emulator vs Real Device

android

提问by yanchenko

What are the differences developers should be aware of?

开发人员应该注意哪些差异?

采纳答案by Jiri

I am aware of these limitations:

我知道这些限制:

  1. Pre-installed software. Real device can have preinstalled a lot more applications than emulator.
  2. You cannot use "capture" photo/video functions in emulator.
  1. 预装软件。真实设备可以预装比模拟器多得多的应用程序。
  2. 您不能在模拟器中使用“捕获”照片/视频功能。

According to emulator documentation, its limitations are:

根据模拟器文档,它的局限性是:

The functional limitations of the emulator include:

模拟器的功能限制包括:

  • No support for placing or receiving actual phone calls. You can simulate phone calls (placed and received) through the emulator console, however.

  • No support for USB connections

  • No support for device-attached headphones
  • No support for determining network connected state
  • No support for determining battery charge level and AC charging state
  • No support for determining SD card insert/eject
  • No support for Bluetooth
  • 不支持拨打或接听实际电话。但是,您可以通过模拟器控制台模拟电话呼叫(拨打和接听)。

  • 不支持 USB 连接

  • 不支持设备连接的耳机
  • 不支持确定网络连接状态
  • 不支持确定电池充电水平和交流充电状态
  • 不支持确定 SD 卡插入/弹出
  • 不支持蓝牙

IMO you can use emulator to simplify UI development, to view UI on "device screen", to be sure that app layout is ok, app can be run, you can test some special cases by simulating gps position, network speed or messaging etc. But testing on real device is a must.

IMO 你可以使用模拟器来简化 UI 开发,在“设备屏幕”上查看 UI,确保应用程序布局正常,应用程序可以运行,你可以通过模拟 GPS 位置、网络速度或消息传递等来测试一些特殊情况。但是必须在真实设备上进行测试。

回答by Will

With the 1.5 SDK the following limitations exists (from the SDK website):

1.5 SDK 存在以下限制(来自SDK 网站):

  • No support for placing or receiving actual phone calls. You can simulate phone calls placed and received) through the emulator console, however.
  • No support for USB connections
  • No support for camera/video capture (input).
  • No support for device-attached headphones
  • No support for determining connected state
  • No support for determining battery charge level and AC charging state
  • No support for determining SD card insertion/removal
  • No support for Bluetooth
  • No support for Multitouch
  • 不支持拨打或接听实际电话。但是,您可以通过模拟器控制台模拟拨打和接听电话。
  • 不支持 USB 连接
  • 不支持相机/视频捕获(输入)。
  • 不支持设备连接的耳机
  • 不支持确定连接状态
  • 不支持确定电池充电水平和交流充电状态
  • 不支持确定 SD 卡插入/移除
  • 不支持蓝牙
  • 不支持多点触控

Based on experience I've noticed the following differences in actual developemnt:

根据经验,我注意到实际开发中存在以下差异:

  • There are bugs you'll be able to ignore in the emulator that will crash the device (not closing Cursors for example)
  • You interact with the device differently than the emulator. I use landscape mode a lot more with the real device than I do with the emulator.
  • There's a different CPU. Things that are fast on your emulator will be slower on the real device.
  • You can dogfood with the device. It is harder to dogfood with the emulator.
  • 您可以在模拟器中忽略一些会导致设备崩溃的错误(例如不关闭光标)
  • 您与设备的交互方式与模拟器不同。与模拟器相比,我在真实设备上使用横向模式的次数更多。
  • 有一个不同的CPU。在模拟器上运行得很快的东西在真实设备上会变慢。
  • 您可以使用该设备进行测试。使用模拟器更难进行狗食。

There is a google group hereif you need real device testers.

如果您需要真正的设备测试人员,这里有一个 google 小组。

回答by Ambika

One cannot test touch events with emulator which has to be tested only by means of mouse clicks on emulator which any developer going to develop an application based on touch screens should be aware of.

不能用模拟器测试触摸事件,模拟器只能通过鼠标点击模拟器来测试,任何开发基于触摸屏的应用程序的开发人员都应该知道。

回答by Alex Martelli

I'd say the main thing is that there are several "real devices" currently using Android, and there will be more, with different hardware endowments -- some will have GPS and some won't, ditto for touchscreen, real keyboard as opposed to virtual on-screen one, camera resolution, etc, etc.

我想说的主要是目前有几种“真实设备”在使用 Android,而且还会有更多,具有不同的硬件禀赋——有些会有 GPS,有些没有,触摸屏也是如此,真正的键盘而不是到虚拟屏幕上的一个,相机分辨率等,等等。

While the OS will do a lot of the heavy lifting for you, you still want to make sure your design a user experience that makes sense on every Android device you intend to support, despite the variation in their HW features -- in this sense, designing applications for Android is more similar to designing them for, say, Linux, Windows, or the Web (cater for a wide variety of hardware-configuration details), rather than e.g. Macs or iPhone (where you need to consider a much narrower set of possible HW configurations).

虽然操作系统将为您完成很多繁重的工作,但您仍然希望确保您的设计用户体验在您打算支持的每个 Android 设备上都有意义,尽管它们的硬件功能有所不同——从这个意义上说,为 Android 设计应用程序更类似于为 Linux、Windows 或 Web 设计它们(满足各种硬件配置细节),而不是例如 Mac 或 iPhone(您需要考虑的范围要窄得多)可能的硬件配置)。

The emulator is (or tries to be;-) "one" Android device -- but there will be others ("real" ones;-) with different screen resolutions, input peripheral devices, etc, etc...

模拟器是(或试图成为;-)“一个”Android 设备——但还会有其他(“真实”的;-)具有不同的屏幕分辨率、输入外围设备等......

回答by Christian Gawron

One comment regarding google accounts: With version 8 of the google APIs for Android 2.2, you can add a google account on the device. However, it will only allow authentication for tests of the google APIs (e.g. google documents) but not syncing of contacts etc.

关于 google 帐户的一条评论:使用适用于 Android 2.2 的 google API 版本 8,您可以在设备上添加一个 google 帐户。但是,它只允许对谷歌 API(例如谷歌文档)的测试进行身份验证,但不允许同步联系人等。

回答by Jeff Axelrod

This is a bug, since camera and video support was attempted (incorrectly): the camera and video intents do not store their output in the MediaStore database after "capture."

这是一个错误,因为尝试(错误地)支持相机和视频:相机和视频意图在“捕获”后不会将其输出存储在 MediaStore 数据库中。

回答by Sandeep Shawn Tripathy

In simple term an emulator is a device that runs on your computer screen whereas a real device is something you can hold. There may be a few differences when it comes to use such as you can not use an em. I have written a detailed postabout this you may consider reading.

简单来说,模拟器是一种可以在您的计算机屏幕上运行的设备,而真正的设备则是您可以拿着的东西。使用时可能会有一些差异,例如您不能使用 em。我写了一篇关于这个的详细帖子,你可以考虑阅读。