Monday, January 31, 2011

Android Emulator Slow

I am playing with Android a lot, specially since they released GingerBread and now they just released the first preview of HoneyComb. I started my first application using Froyo in which the emulator was pretty fast and I could boot and work with it normally. When I first started playing with Gingerbread I noticed it was slower than before but I did not give it too much attention and now that HoneyComb preview is out it has been really a pain to work with the Android Emulator. I do not have the latest and greatest laptop but either way just to boot and launch my application could take like 15 or more minutes and sometimes it wouldn't start at all.

Obviously something was wrong here and started looking at some options to improve it. First I found out that when you create an android virtual device ( AVD ) the default RAM is just 96 MB so you might want to increase it, for example Nexus One has 512 MB of RAM. All the hardware configurations can be found here.

Another thing I found is that starting the AVD from the AVD manager is faster than staring it from eclipse. So you first start he AVD you want to use for your application and once it is up an running you  execute your application. I noticed a huge improvement in boot time and application start by doing this.

The third option is to use command line to start the AVD and once it is started you can install your application. This way is the faster I think. It seems the eclipse integration has some issues still. So if you like command line, you can use this method. The commands for the emulator can be found here and how to install your application from command line can be found here. Basically you have to do this:
  1. open a command line
  2. execute: emulator -avd <avd_name>
  3. once the emulator es up and running then you execute: adb install <path_to_apk>
Just remember both tools need to be added to your PATH variable otherwise you will have to go to the folders that contain them.

Hope this tips help someone :)

happy coding :)

No comments:

Post a Comment