我可以调整我的 Android 模拟器以使其速度更快吗?
我正在使用 android 模拟器来运行我的程序。 但它确实很慢。 启动并显示主屏幕大约需要 90 秒。 我可以调整它,以便大大减少这个时间吗? 谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(13)
我建议您使用 Genymotion 。它是一个非常快的模拟器(在我的情况下运行不到 10 秒)
它安装了 Google Apps,还包括 Google Play 应用程序,可以下载任何应用程序。对于使用 Maps Api 测试应用程序来说,这是一个很好的功能。
I recommend you to use Genymotion . It's a very fast emulator (less than 10 seconds to run in my case)
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.
您需要安装
Intel HAXM
SDK
并安装AVD
如果没有,那么您将需要安装
Accelerated Execution Manager
请参阅此运行适用于 Android 的新英特尔模拟器,了解如何执行此操作
< img src="https://i.sstatic.net/9j2C7.png" alt="在此处输入图像描述">
看看您能快多少 视频
You need to install
Intel HAXM
SDK
and installAVD
if not then you will need to install
Accelerated Execution Manager
See this Running the new Intel emulator for Android on how can you do this
see how much faster do you get Video
在开发我的游戏 Elastic World 时,我遇到了同样的问题。等待模拟器启动几分钟后,游戏以最高 20 FPS 的速度运行。即使在低端 Android 设备上我也可以轻松获得 60 FPS。
因此,我按照以下网站的说明转移到 VMWare Android 计算机:http://www. android-x86.org/documents/installhowto/
相同的游戏循环现在以 250 FPS 运行。 (这个速度无法玩,我将游戏限制为最大 60 FPS,但超越此限制,它会提供 250 FPS)
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.
So I moved to a VMWare Android machine, following the instructions from this site: 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)
尝试为您的模拟器使用较小的分辨率,例如 HVGA。由于使用软件渲染,模拟器需要渲染的像素越多,速度就越慢。
此外,如果您的计算机上有足够的内存,请为模拟器添加至少 1 GB 内存。这是创建 AVD 期间的“设备内存大小”值。
还要为快照设置“启用”标志。这将保存模拟器的状态并使其启动速度更快。
Try to use a smaller resolution for your emulator as for example HVGA. The emulator gets slower the more pixels its needs to render as it is using software rendering.
Also if you have sufficient memory on your computer, add at least 1 GB of memory to your emulator. This is the value "Device ram size" during the creation of the AVD.
Also set the flag "Enabled" for Snapshots. This will save the state of the emulator and let it start much faster.
只需在 AVD 管理器中启用“快照”复选框即可。当您关闭 AVD 时,它会保存它的状态。因此,一旦您再次运行模拟器,就会加载保存的状态。因此,AVD 的启动时间将大大缩短。
Just enable "Snapshot" checkbox in your AVD Manager. It will save the state of your AVD when you close it. So, once you run the emulator again, that saved state will be loaded. Hence the boot up time of your AVD will be considerably reduced.
emulator -cpu-delay 0 -no-boot-anim -缓存 ./cache -avd-gpu on
(按照链接和链接)结果运行速度提高约 2-3 倍
emulator -cpu-delay 0 -no-boot-anim -cache ./cache -avd <adv-name> -gpu on
(follow link and link)results is run ~2-3x faster
我遇到了类似的问题(线程此处)。然而,我的需要10-15分钟。考虑到 Android 讨论组中有很多线程,90 秒已经是非常快了。模拟器本质上很慢,我读到的唯一建议是保持模拟器打开,而不是关闭它并重新运行它。但是,正如我的帖子中提到的,如果您有物理 Android 设备,则可以在该设备上运行它。这就是我现在正在做的事情,这是一流的建议。无需漫长的等待时间。如果您没有物理设备,那么我只能建议您不要在代码更改之间关闭模拟器,因为系统会识别更改。
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.
使用这 3 个选项。
emulator --cpu-delay 0 --no-boot-anim --cache ./cache --avd avd_name
前两个是显而易见的。第三个将使模拟器的内存持久化。你可以将它指向任何不会被启动破坏的文件(/tmp 会发生这种情况),它就像一个永远在线的休眠设备。
use those 3 options.
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.
如果你绝对不能使用物理Android设备,你可以做的就是在Virtualbox上运行Android操作系统,然后获取模拟Android的IP地址。然后,您可以使用该 IP 地址将 ADB 连接到模拟器。这就是它的要点。我在我的博客上写了关于此方法的更详细指南。 http://www.bobbychanblog.com/2011/07/faster-android -emulator-alternative-using-virtualbox/
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/
缩小模拟器的规模使我的模拟器加载速度更快......
Scaling the emulator down made my emulator load faster...
实际上这些都是很好的答案,但是你有没有想过将内存从默认的 96mb 更改为 512 之类的?对我有用:)
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 :)
如果您随身携带移动设备,则通过 USB 将其编译到设备会更快(也更可靠)。编译并安装到手机上大约需要 5 秒,我不再使用模拟器了 - 只是速度太慢了。
它不仅速度慢,而且除了静态小部件(动画)之外的任何东西都将难以在模拟器上运行,并且您会注意到滞后。
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.
Not only is it slow but anything other than static widgets (animation) will struggle to run on the emulator and you will notice lag.