Can I tweak my android emulator to make it fast?
Asked Answered
F

13

60

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

Flong answered 28/12, 2009 at 6:3 Comment(1)
C
35

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.

Caucasoid answered 28/12, 2009 at 6:7 Comment(6)
Yeah exactly. Let the emulator run n rerun the code after editing. Its like hot swappable. ThanksFlong
I didn't look at the link, but for my system I'm looking at times that are more like: first boot: 90sec, subsequent boot: 15-20sec boot. I'm not on blazing-fast hardware (laptop, 2ghz core2-duo, 4gig ram), Ubuntu... is it possible something else is slowing it down?Mauk
Leaving it running is very useful indeed. I personally switched to using the phone itself as the only debug tool. Just connect the cable, configure it and it runs immediately, no need to wait, plus supports orientation changes... Regards, AriKnuckleduster
@fiXedd: I'm not sure if there are that many ways to speed it up. Before I actually used a physical device, I was looking around for various ways to increase the speed of the emulator, but I couldn't really find much information on it. Even if there are a few minor changes you can make, I don't know how significant the speed up will be on current versions of the emulator.Caucasoid
You can't run different versions of the app on one device. How are you going to test 1.5 on a 2.1 device?Kura
@Kura - I haven't done any Android programming lately, so I don't know if the emulators have been made faster lately. Still, if you have to test your program on a device you don't have, you don't really have any choice but to use the emulator. A good idea could be to get your program running to a decent level on your current phone, then use the emulator for the other versions.Caucasoid
K
31

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.

Kura answered 25/10, 2010 at 6:17 Comment(2)
Where do we save this? At what file location?Imply
@Imply if you mean where the cache file will be, well anywhere. ./ means "at the place where i'm at when i run this command". but you can replace it with any file (which will be created if do not exist) such as --cache /home/thompson/androidcacheKura
I
9

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/

Inerney answered 11/7, 2011 at 6:56 Comment(0)
P
8
  1. The -no-boot-anim parameter is good.
  2. Don't turn the emulator off, just re-launch your app.
  3. For further speedups, try the new snapshot feature, which is described here.
Prophet answered 24/3, 2011 at 14:2 Comment(0)
C
2

Scaling the emulator down made my emulator load faster...

emulator -cpu-delay 0 -no-boot-anim -cache ./cache -scale 0.8 -avd avd_name
Creationism answered 14/3, 2011 at 19:37 Comment(1)
i actually got worse results with -scale. Nothing noticeable without measurement, but it was worse.Kura
F
2

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 :)

Featherbedding answered 21/4, 2011 at 20:12 Comment(0)
S
2

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.

Sensuous answered 14/5, 2011 at 10:51 Comment(2)
Real device really is the only way to go. It is just streets faster.Panhandle
It's not feasible to have one device to each combination of screen size and OS version. Even if it was, people would be asking how to keep 12 phones on the table :) ...the main issue with the emulator is that it only uses one CPU even on a 8core i7. But it's still the only way to automate nightly tests in several devices (and since it only uses one CPU, you can run 8 jobs :)Kura
C
2

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.

Cunctation answered 28/10, 2013 at 8:37 Comment(0)
G
2

You need to install Intel HAXM

  • open you SDK and install

enter image description here

  • Create a new AVD

enter image description here

  • Now when run it you should get this

enter image description here

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

enter image description here

see how much faster do you get Video

Goahead answered 8/2, 2014 at 13:33 Comment(1)
I followed the steps you have mentioned and i am able to start my emulator using intel x86_64 virtual device in 60 seconds..but i dont see any "HAX is working and emulator runs fast in virt mode"..i have windows 7 64 bit..Intel HAXM 1.1.1 is installed..Virtualization is also supported in my PC..Egest
H
1

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)

Hooke answered 4/7, 2012 at 11:28 Comment(0)
T
0

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.

Treasatreason answered 18/1, 2012 at 6:5 Comment(0)
T
0

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.

Tranship answered 13/11, 2012 at 15:55 Comment(0)
B
0
  1. First I follow this introduction
  2. Run emulation with command : emulator -cpu-delay 0 -no-boot-anim -cache ./cache -avd <adv-name> -gpu on (follow link and link)

results is run ~2-3x faster

Bream answered 29/8, 2013 at 2:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.