Android 模拟器需要多长时间才能启动?如果每次更改Java代码都需要关闭/启动吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2479550/
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
How long does the Android Emulator take to start? Do you need to close/start if every time you change Java code?
提问by benstpierre
When developing for Android do you typically need to stop the emulator and restart it every time you make a change to your Java code or is there a faster way? The emulator takes about 1.5 minutes to start for me, is this normal?
在为 Android 开发时,您通常需要在每次更改 Java 代码时停止模拟器并重新启动它,还是有更快的方法?模拟器对我来说启动大概需要1.5分钟,这正常吗?
采纳答案by jqpubliq
Yes. Starting an emulator is slow, but you don't need to reboot it usually when you make changes. You can just target the already running emulator, at least in eclipse.
是的。启动模拟器很慢,但在进行更改时通常不需要重新启动它。您可以只针对已经运行的模拟器,至少在 eclipse 中是这样。
回答by Booger
It is worthwhile to use the "Snapshot" functionality of the emulator. It can be enabled when you create (or you can edit) your AVD image.
值得使用模拟器的“快照”功能。它可以在您创建(或编辑)您的 AVD 图像时启用。
This will take a "Snapshot" of the emulator image when you stop running. Then it restarts the emulator to that exact same place.
这将在您停止运行时拍摄模拟器图像的“快照”。然后它将模拟器重新启动到完全相同的位置。
When using this feature, the emulator start-up time is sped up by a factor if 10+ (I see a 10 sec start-up compared to 90 sec to bring it up from scratch).
使用此功能时,仿真器启动时间加快了 10+ 倍(我看到启动时间为 10 秒,而从头开始则为 90 秒)。
It is important to note, that this will maintain "state" of your emulator between runs. This can be useful if you are trying to test a particular scenario. It can be bad if you run your emulator out of memory, then "snapshot" that (at which point, you can always take a fresh snapshot, and start again).
重要的是要注意,这将在运行之间保持模拟器的“状态”。如果您尝试测试特定场景,这会很有用。如果您的模拟器内存不足,然后“快照”它(此时,您总是可以拍摄新的快照,然后重新开始),这可能会很糟糕。
回答by lbedogni
The emulator take some time to start, depending on the running machine and the amount of programs you are running on the host.
模拟器需要一些时间才能启动,具体取决于正在运行的机器和您在主机上运行的程序数量。
If you installed the eclipse plugin, you don't need to restart the emulator each time: simply hit run in eclipse, and the plugin will take care of making the .apk package, put it in the device and start the activity (if any).
如果您安装了 eclipse 插件,则不需要每次都重新启动模拟器:只需在 eclipse 中点击运行,插件将负责制作 .apk 包,将其放入设备并启动 Activity(如果有) )。
回答by hvdm
There is really no need to restart the emulator. You can keep it running all day (or longer). If you do not use eclipse: adb install -r will do the job (-r to replace the existing package) and restart your app.
真的没有必要重新启动模拟器。您可以让它运行一整天(或更长时间)。如果您不使用 eclipse: adb install -r 将完成这项工作(-r 替换现有包)并重新启动您的应用程序。
回答by Matt Shirilla
Mine takes a minute + to start. I tried adding -no-boot-animto speed it up, but the few tests I did it did not speed it up.
我的需要一分钟 + 才能启动。我尝试添加-no-boot-anim来加速它,但我所做的几个测试并没有加速它。
回答by thecodedeveloper.com
There is no need to close Android Emulator when you changes in code just simple do one thing
更改代码时无需关闭 Android Emulator 只需简单地做一件事
- Leave AVD running and you will have to press F11 (or run your app), make sure you are at home screen of AVD.
- 保持 AVD 运行,您必须按 F11(或运行您的应用程序),确保您处于 AVD 的主屏幕。
回答by Alex Florescu
To start the emulator in Eclipse, go to Window -> Android SDK and AVD Manager, then select the virtual device you want and hit start. This way it will stay on and not shutdown when your app terminates.
要在 Eclipse 中启动模拟器,请转到 Window -> Android SDK and AVD Manager,然后选择您想要的虚拟设备并点击开始。这样,当您的应用程序终止时,它将保持开启状态而不关闭。
回答by Robby Pond
I have noticed that sometimes I have to shut down the emulator and restart it. It appears to hang at "waiting for home to launch". This only hangs the first time. Once it successfully launches I can reinstall repeatedly with no issues.
我注意到有时我必须关闭模拟器并重新启动它。它似乎挂在“等待回家发射”。这只在第一次挂起。一旦它成功启动,我就可以反复重新安装,没有任何问题。
回答by While-E
Yes, as everyone said you don't have to restart the emulator. I'm not sure if it's my computer (obviously to some degree it would be)but even when I simply make a one line change and relaunch, eclipse/AVD take roughly 2-3 minutes to fully load my new package to the emulator. Sucks having to wait this long between changes, but it also makes you want to write better code the first timerather than being sloppy and just test the results.
是的,正如每个人所说的,您不必重新启动模拟器。我不确定这是否是我的电脑(显然在某种程度上是这样)但即使我只是简单地更改一行并重新启动,eclipse/AVD 大约需要 2-3 分钟才能将我的新包完全加载到模拟器。在更改之间等待这么长时间很糟糕,但这也让您想在第一次编写更好的代码,而不是草率地测试结果。