Android模拟器有多“好”?

时间:2022-05-17 07:01:07

As the title says, how "good" is the Android emulator?

正如题目所说,Android模拟器有多“好”?

I don't have an Android phone but would it be possible to develop purely using the emulator as the testing environment?

我没有Android手机,但是是否有可能完全使用模拟器作为测试环境来开发?

My initial questions about it:

我最初的问题是:

  • Is the emulator as responsive as a normal android phone (of course this depends on the exact phone but in general)?
  • 模拟器的响应速度是否和普通的android手机一样快?
  • Is there a way to control the memory on the emulator?
  • 有办法控制模拟器上的内存吗?
  • Has anyone had issues that have been flagged on the phone but not the emulator? or vice versa?
  • 是否有人有问题被标记在电话而不是模拟器上?反之亦然?
  • What's your normal testing procedure to test on both throughout, or emulator recursively and phone at the end?
  • 在整个过程中,或者递归地对模拟器和最后调用进行测试的常规测试过程是什么?

Any feedback would be appreciated.

如有任何反馈,我们将不胜感激。

Thanks,

谢谢,

6 个解决方案

#1


7  

Q: Is the emulator as responsive as a normal android phone (of course this depends on the exact phone but in general)?
A: Absolutely not! The worst example is the 3D, which is, afaik, only software emulation.

问:仿真器是否和普通的android手机一样灵敏?绝对不是!最糟糕的例子是3D,也就是afaik,仅仅是软件模拟。

Q: Is there a way to control the memory on the emulator?
A: Please specify, the size of the SD-Card is configurable, the RAM/VM-Memory... I don't know.

有办法控制模拟器上的内存吗?A:请说明,sd卡的大小是可配置的,RAM/ vm内存……我不知道。

Q: Has anyone had issues that have been flagged on the phone but not the emulator? or vice versa?
A: Each device has his own customization. On the emulator you can only change the screen resolution, but caution: the size of your Emulator screen depends on the pixel density you set up. So what might look good on your big emulator could be too tiny on a real device. And don't forget, a finger is much bigger and not as accurate as a mouse cursor.

问:有没有人遇到过手机上标记的问题,但不是模拟器?反之亦然?答:每个设备都有自己的定制。在模拟器上,只能更改屏幕分辨率,但要注意:模拟器屏幕的大小取决于您设置的像素密度。所以在你的大模拟器上看起来不错的东西在真正的设备上可能太小了。别忘了,手指比鼠标指针大得多,也不像鼠标指针那么精确。

Q: What's your normal testing procedure to test on both throughout, or emulator recursively and phone at the end?
A: Functionality is tested during the implementation mainly on a (fast) device, like a Nexus One. The real test after implementation will be on as many devices as possible. The UI, too (most differences there)

问:在整个测试过程中,或者递归地测试仿真器,最后进行电话测试,您的常规测试过程是什么?答:功能在实现过程中主要是在一个(快速)设备上进行测试,比如Nexus One。实现后的真正测试将在尽可能多的设备上进行。UI也一样(大部分差异)

Since I have a device which is has the latest SDK, I prefer testing on the device. Thats not necessary for programming an app, but please: don't publish an app without at least one test round on a real device :)

由于我的设备有最新的SDK,所以我更喜欢在设备上进行测试。这对编写应用程序来说是不必要的,但请注意:在真正的设备上,如果没有至少一次测试,就不要发布应用程序。

#2


3  

  1. Yes, the emulator is very fast.
  2. 是的,模拟器非常快。
  3. Yes, you can set the RAM size of the target you wish to emulate.
  4. 是的,您可以设置您希望模拟的目标的RAM大小。
  5. I'm sure someone has, but I haven't.
  6. 我肯定有人有,但我没有。
  7. I usually test on the emulator during development, then on my G1 when I'm ready for longer term testing. After that I test on the emulator when checking compatibility with 1.5, 2.0, and 2.1 targets.
  8. 我通常在开发过程中对模拟器进行测试,然后在我准备进行更长的测试时在G1上进行测试。在此之后,我在模拟器上进行测试,检查与1.5、2.0和2.1目标的兼容性。

See here for what options targets support. Note there is a GUI tool for setting these up as well.

请参阅这里的选项以支持哪些选项。注意,还有一个GUI工具可以设置这些内容。

#3


1  

To answer the general question about how "good" the emulator is you need to look at what the emulator is.

要回答关于模拟器有多“好”的一般问题,您需要查看模拟器是什么。

The emulator is a piece of software (qemu) that is able to run arm instructions on a developer machine using emulation. This means that the emulator will run an android platform similar to what is running on a physical device. This setup is better than using a simulator where the platform is compiled for the development machine and not for the target hardware. There is however a number of limitations such as

仿真器是一种软件(qemu),它能够在开发人员机器上使用模拟来运行arm指令。这意味着模拟器将运行一个android平台,类似于在物理设备上运行的平台。这种设置比使用模拟器要好,在模拟器中,平台是为开发机器而不是目标硬件编译的。但是也有一些限制,比如

  • peripheral support - a mobile platform includes a number of companion chips such as bluetooth, wlan, gps, radio access, graphics acceleration etc. All of these are interacting with the main CPU in ways that are not predictable and hard to simulate on the emulator. Some are supported in a limited way such as internet access while others are not supported at all such as bluetooth.
  • 外围设备支持——一个移动平台包括一些配套芯片,如蓝牙、无线局域网、gps、无线接入、图形加速等。所有这些都是以无法预测的方式与主CPU进行交互,并且很难在模拟器上模拟。有些以有限的方式支持,如internet访问,而另一些则完全不支持,如蓝牙。
  • performance - the emulator is not a real processor and may not use physical accelerators available on an actual device. It also uses the host machine hardware for a lot of things meaning that memory access and similar items behave differently compared with testing on an actual device.
  • 性能——仿真器不是真正的处理器,也不能在实际设备上使用物理加速器。它还使用主机硬件做很多事情,这意味着与实际设备上的测试相比,内存访问和类似项目的行为不同。

The general rule is that if it is possible try to do as much testing as possible on a device to avoid surprises in the end. The emulator is good for things such as testing general functionality, initial testing to avoid obvious bugs and checking that layouts and UI look decent at different screen sizes. When it comes to any performance critical testing or behaviour when interacting with the outside world, such as network interaction, the emulator is not recommended. It may tell you that your application has serious issues but do not trust "good enough" on the emulator to be good enough for the real world.

一般的规则是,如果可能的话,尝试在设备上做尽可能多的测试,以避免最终出现意外。仿真器很适合测试一般功能、初始测试以避免明显的错误,以及检查不同屏幕大小的布局和UI是否美观。当涉及到与外界交互时的性能关键测试或行为时,例如网络交互时,不建议使用仿真器。它可能会告诉您,您的应用程序有严重的问题,但是不要相信仿真器上的“足够好”对于现实世界来说足够好。

#4


1  

I'm going to answer #3 only, because the other answers have been covered already.

我将只回答第3题,因为其他答案已经被涵盖。

There's definitely some issues that are only present on the emulator and not on the device itself. One big one is that airport mode simply doesn't work on the emulator; internet still works despite turning airport mode on.

肯定有一些问题只出现在模拟器上而不是设备本身。一个重要的原因是机场模式在模拟器上根本不起作用;尽管启用了机场模式,但互联网仍然有效。

Also, if you're just using a stock emulator, you can't access the market, which means that any way which your app may try to interact with it can't be tested via emulator.

另外,如果你只是使用股票模拟器,你就无法进入市场,这意味着你的应用可能试图与之交互的任何方式都无法通过模拟器进行测试。

I know there are some other smaller issues which I've run into between an actual device and the emulator. There are enough things such that I highly recommended you don't develop solely on an emulator.

我知道在实际设备和仿真器之间还会遇到一些更小的问题。我强烈建议您不要只在模拟器上开发。

#5


0  

With emulator only your testing will have more mock testing to cover:

有了模拟器,只有你的测试将包含更多的模拟测试:

-touch -sensor

触觉传感器

There frameworks to plugin to simulate sensor/device movement, camera by using your webcam, etc.

有一些框架的插件来模拟传感器/设备移动,摄像头使用你的摄像头,等等。

#6


0  

  1. You need memory to use emulatord like AVD emulator, emulator is good for testing but sometimes it can crash without reason.
  2. 您需要内存来使用像AVD仿真器这样的仿真器,仿真器可以很好地进行测试,但是有时它会无缘无故地崩溃。
  3. Yes you can change this settings many times.
  4. 是的,你可以多次修改这个设置。
  5. Some time ago I cannot emulate accelometer, but right now I can.
  6. 前段时间我还不能模拟加速计,但现在我可以。
  7. I prefer to test my app on real device. I prefer testing my app on real devices (if my frends cannot creash it and JUnit tests works then it shouldn't be a problem), but I test different screen size on emulators.
  8. 我更喜欢在真实设备上测试我的应用程序。我更喜欢在真正的设备上测试我的应用程序(如果我的朋友不能使它崩溃并且JUnit测试可以工作,那么它应该不是问题),但是我在模拟器上测试不同的屏幕大小。

#1


7  

Q: Is the emulator as responsive as a normal android phone (of course this depends on the exact phone but in general)?
A: Absolutely not! The worst example is the 3D, which is, afaik, only software emulation.

问:仿真器是否和普通的android手机一样灵敏?绝对不是!最糟糕的例子是3D,也就是afaik,仅仅是软件模拟。

Q: Is there a way to control the memory on the emulator?
A: Please specify, the size of the SD-Card is configurable, the RAM/VM-Memory... I don't know.

有办法控制模拟器上的内存吗?A:请说明,sd卡的大小是可配置的,RAM/ vm内存……我不知道。

Q: Has anyone had issues that have been flagged on the phone but not the emulator? or vice versa?
A: Each device has his own customization. On the emulator you can only change the screen resolution, but caution: the size of your Emulator screen depends on the pixel density you set up. So what might look good on your big emulator could be too tiny on a real device. And don't forget, a finger is much bigger and not as accurate as a mouse cursor.

问:有没有人遇到过手机上标记的问题,但不是模拟器?反之亦然?答:每个设备都有自己的定制。在模拟器上,只能更改屏幕分辨率,但要注意:模拟器屏幕的大小取决于您设置的像素密度。所以在你的大模拟器上看起来不错的东西在真正的设备上可能太小了。别忘了,手指比鼠标指针大得多,也不像鼠标指针那么精确。

Q: What's your normal testing procedure to test on both throughout, or emulator recursively and phone at the end?
A: Functionality is tested during the implementation mainly on a (fast) device, like a Nexus One. The real test after implementation will be on as many devices as possible. The UI, too (most differences there)

问:在整个测试过程中,或者递归地测试仿真器,最后进行电话测试,您的常规测试过程是什么?答:功能在实现过程中主要是在一个(快速)设备上进行测试,比如Nexus One。实现后的真正测试将在尽可能多的设备上进行。UI也一样(大部分差异)

Since I have a device which is has the latest SDK, I prefer testing on the device. Thats not necessary for programming an app, but please: don't publish an app without at least one test round on a real device :)

由于我的设备有最新的SDK,所以我更喜欢在设备上进行测试。这对编写应用程序来说是不必要的,但请注意:在真正的设备上,如果没有至少一次测试,就不要发布应用程序。

#2


3  

  1. Yes, the emulator is very fast.
  2. 是的,模拟器非常快。
  3. Yes, you can set the RAM size of the target you wish to emulate.
  4. 是的,您可以设置您希望模拟的目标的RAM大小。
  5. I'm sure someone has, but I haven't.
  6. 我肯定有人有,但我没有。
  7. I usually test on the emulator during development, then on my G1 when I'm ready for longer term testing. After that I test on the emulator when checking compatibility with 1.5, 2.0, and 2.1 targets.
  8. 我通常在开发过程中对模拟器进行测试,然后在我准备进行更长的测试时在G1上进行测试。在此之后,我在模拟器上进行测试,检查与1.5、2.0和2.1目标的兼容性。

See here for what options targets support. Note there is a GUI tool for setting these up as well.

请参阅这里的选项以支持哪些选项。注意,还有一个GUI工具可以设置这些内容。

#3


1  

To answer the general question about how "good" the emulator is you need to look at what the emulator is.

要回答关于模拟器有多“好”的一般问题,您需要查看模拟器是什么。

The emulator is a piece of software (qemu) that is able to run arm instructions on a developer machine using emulation. This means that the emulator will run an android platform similar to what is running on a physical device. This setup is better than using a simulator where the platform is compiled for the development machine and not for the target hardware. There is however a number of limitations such as

仿真器是一种软件(qemu),它能够在开发人员机器上使用模拟来运行arm指令。这意味着模拟器将运行一个android平台,类似于在物理设备上运行的平台。这种设置比使用模拟器要好,在模拟器中,平台是为开发机器而不是目标硬件编译的。但是也有一些限制,比如

  • peripheral support - a mobile platform includes a number of companion chips such as bluetooth, wlan, gps, radio access, graphics acceleration etc. All of these are interacting with the main CPU in ways that are not predictable and hard to simulate on the emulator. Some are supported in a limited way such as internet access while others are not supported at all such as bluetooth.
  • 外围设备支持——一个移动平台包括一些配套芯片,如蓝牙、无线局域网、gps、无线接入、图形加速等。所有这些都是以无法预测的方式与主CPU进行交互,并且很难在模拟器上模拟。有些以有限的方式支持,如internet访问,而另一些则完全不支持,如蓝牙。
  • performance - the emulator is not a real processor and may not use physical accelerators available on an actual device. It also uses the host machine hardware for a lot of things meaning that memory access and similar items behave differently compared with testing on an actual device.
  • 性能——仿真器不是真正的处理器,也不能在实际设备上使用物理加速器。它还使用主机硬件做很多事情,这意味着与实际设备上的测试相比,内存访问和类似项目的行为不同。

The general rule is that if it is possible try to do as much testing as possible on a device to avoid surprises in the end. The emulator is good for things such as testing general functionality, initial testing to avoid obvious bugs and checking that layouts and UI look decent at different screen sizes. When it comes to any performance critical testing or behaviour when interacting with the outside world, such as network interaction, the emulator is not recommended. It may tell you that your application has serious issues but do not trust "good enough" on the emulator to be good enough for the real world.

一般的规则是,如果可能的话,尝试在设备上做尽可能多的测试,以避免最终出现意外。仿真器很适合测试一般功能、初始测试以避免明显的错误,以及检查不同屏幕大小的布局和UI是否美观。当涉及到与外界交互时的性能关键测试或行为时,例如网络交互时,不建议使用仿真器。它可能会告诉您,您的应用程序有严重的问题,但是不要相信仿真器上的“足够好”对于现实世界来说足够好。

#4


1  

I'm going to answer #3 only, because the other answers have been covered already.

我将只回答第3题,因为其他答案已经被涵盖。

There's definitely some issues that are only present on the emulator and not on the device itself. One big one is that airport mode simply doesn't work on the emulator; internet still works despite turning airport mode on.

肯定有一些问题只出现在模拟器上而不是设备本身。一个重要的原因是机场模式在模拟器上根本不起作用;尽管启用了机场模式,但互联网仍然有效。

Also, if you're just using a stock emulator, you can't access the market, which means that any way which your app may try to interact with it can't be tested via emulator.

另外,如果你只是使用股票模拟器,你就无法进入市场,这意味着你的应用可能试图与之交互的任何方式都无法通过模拟器进行测试。

I know there are some other smaller issues which I've run into between an actual device and the emulator. There are enough things such that I highly recommended you don't develop solely on an emulator.

我知道在实际设备和仿真器之间还会遇到一些更小的问题。我强烈建议您不要只在模拟器上开发。

#5


0  

With emulator only your testing will have more mock testing to cover:

有了模拟器,只有你的测试将包含更多的模拟测试:

-touch -sensor

触觉传感器

There frameworks to plugin to simulate sensor/device movement, camera by using your webcam, etc.

有一些框架的插件来模拟传感器/设备移动,摄像头使用你的摄像头,等等。

#6


0  

  1. You need memory to use emulatord like AVD emulator, emulator is good for testing but sometimes it can crash without reason.
  2. 您需要内存来使用像AVD仿真器这样的仿真器,仿真器可以很好地进行测试,但是有时它会无缘无故地崩溃。
  3. Yes you can change this settings many times.
  4. 是的,你可以多次修改这个设置。
  5. Some time ago I cannot emulate accelometer, but right now I can.
  6. 前段时间我还不能模拟加速计,但现在我可以。
  7. I prefer to test my app on real device. I prefer testing my app on real devices (if my frends cannot creash it and JUnit tests works then it shouldn't be a problem), but I test different screen size on emulators.
  8. 我更喜欢在真实设备上测试我的应用程序。我更喜欢在真正的设备上测试我的应用程序(如果我的朋友不能使它崩溃并且JUnit测试可以工作,那么它应该不是问题),但是我在模拟器上测试不同的屏幕大小。