我可以调整我的 android 模拟器以使其更快吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1968170/
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
Can I tweak my android emulator to make it fast?
提问by Bohemian
I am using the android emulator to run my programs. But its really slow. It takes around 90 seconds to startup and show the home screen. Can I tweak it so that I can reduce this time considerably? Thanks
我正在使用 android 模拟器来运行我的程序。但它真的很慢。启动和显示主屏幕大约需要 90 秒。我可以调整它以便我可以大大减少这个时间吗?谢谢
采纳答案by keyboardP
I was having a similar problem (thread here). However, mine was taking 10-15 mins. 90 seconds is blazing fast considering a lot of threads in the Android discussion groups. The emulator is slow by nature and the only recommendation I read was to keep the emulator open instead of closing it and rerunning it. However, as mentioned in my thread, if you have a physical Android device, you can just run it on that. It's what I'm doing at the moment and it was top-notch advice. No long waiting time. If you don't have a physical device, then I can only suggest you don't close the emulator between code changes, as the system will recognise the change.
我遇到了类似的问题(这里的线程)。然而,我的需要10-15分钟。考虑到 Android 讨论组中的大量线程,90 秒是非常快的。模拟器本质上很慢,我读到的唯一建议是让模拟器保持打开状态,而不是关闭它并重新运行它。但是,正如我在我的帖子中提到的,如果您有一个物理 Android 设备,则可以在该设备上运行它。这就是我目前正在做的事情,这是一流的建议。没有漫长的等待时间。如果您没有物理设备,那么我只能建议您不要在代码更改之间关闭模拟器,因为系统会识别更改。
回答by gcb
use those 3 options.
使用这 3 个选项。
emulator --cpu-delay 0 --no-boot-anim --cache ./cache --avd avd_name
emulator --cpu-delay 0 --no-boot-anim --cache ./cache --avd avd_name
the first two are obvious. the third one will make the memory of the emulator kind of persistent. you can point it to any file that does not get destroyed by boot (such happens with /tmp) it's like a always-on hibernating device.
前两个是显而易见的。第三个将使模拟器的内存具有持久性。您可以将它指向任何不会被引导破坏的文件(/tmp 会发生这种情况),它就像一个永远在线的休眠设备。
回答by Bobby
If you absolutely cannot use a physical Android device, what you can do is run the Android OS on Virtualbox, and then get the IP address of the emulated Android. Then you'd connect ADB to the emulator using that IP address. That's the jist of it. I've written a more detailed guide to this approach on my blog. http://www.bobbychanblog.com/2011/07/faster-android-emulator-alternative-using-virtualbox/
如果你绝对不能使用物理Android设备,你可以做的是在Virtualbox上运行Android操作系统,然后获取模拟Android的IP地址。然后,您将使用该 IP 地址将 ADB 连接到模拟器。这就是它的要点。我在我的博客上写了一篇关于这种方法的更详细的指南。http://www.bobbychanblog.com/2011/07/faster-android-emulator-alternative-using-virtualbox/
回答by Tomas Andrle
回答by jay
actually these are all great answers, but have u thought of changing the ram from the default 96mb to something like 512? works for me :)
实际上,这些都是很好的答案,但是您有没有想过将 ram 从默认的 96mb 更改为 512 之类的?对我有用:)
回答by Ricky
If you have the mobile device with you, it's much quicker (and more reliable) to compile it via USB to the device. It takes around 5 seconds to compile and install on your phone, I never use the emulator anymore - it's just to slow.
如果您随身携带移动设备,则通过 USB 将其编译到设备会更快(也更可靠)。在您的手机上编译和安装大约需要 5 秒钟,我不再使用模拟器了 - 只是太慢了。
Not only is it slow but anything other than static widgets (animation) will struggle to run on the emulator and you will notice lag.
它不仅速度慢,而且除了静态小部件(动画)之外的任何东西都很难在模拟器上运行,你会注意到滞后。
回答by sulabh
Scaling the emulator down made my emulator load faster...
缩小模拟器使我的模拟器加载速度更快...
emulator -cpu-delay 0 -no-boot-anim -cache ./cache -scale 0.8 -avd avd_name
回答by Mongi Zaidi
I recommend you to use Genymotion. It's a very fast emulator (less than 10 seconds to run in my case)
我建议您使用Genymotion。这是一个非常快的模拟器(在我的情况下运行不到 10 秒)
It has Google Apps installed also including Google Play App which give the chance to download any app. This is a good feature for testing apps with Maps Api.
它安装了 Google Apps 还包括 Google Play 应用程序,可以下载任何应用程序。这是使用 Maps Api 测试应用程序的一个很好的功能。
回答by Mina Gabriel
You need to install Intel HAXM
你需要安装 Intel HAXM
- open you
SDK
and install
- 打开你
SDK
并安装
- Create a new
AVD
- 创建一个新的
AVD
- Now when run it you should get this
- 现在运行它你应该得到这个
if not then you will need to install Accelerated Execution Manager
如果没有,那么你需要安装 Accelerated Execution Manager
See this Running the new Intel emulator for Androidon how can you do this
请参阅此运行适用于 Android 的新英特尔模拟器了解如何执行此操作
see how much faster do you get Video
看看你获得视频的速度有多快
回答by Pedro Soares
While developing my game, Elastic World, I was suffering from the same problem. After waiting minutes for the emulator to startup, the game was running at 20 FPS maximum. Even on low end android devices I could easily get 60 FPS.
在开发我的游戏 Elastic World 时,我也遇到了同样的问题。在等待模拟器启动几分钟后,游戏以最高 20 FPS 的速度运行。即使在低端 android 设备上,我也可以轻松获得 60 FPS。
So I moved to a VMWare Android machine, following the instructions from this site: http://www.android-x86.org/documents/installhowto/
所以我按照这个网站的说明转移到了一台 VMWare Android 机器上:http: //www.android-x86.org/documents/installhowto/
The same game loop now runs at 250 FPS. (it's not playable at this speed and I have the game limited to max 60 FPS, but overriding this limitation it gives 250 FPS)
相同的游戏循环现在以 250 FPS 运行。(它无法以这种速度播放,我将游戏限制为最大 60 FPS,但覆盖此限制后它会提供 250 FPS)