The default android emulator is ridiculously slow and resource hungry, which makes it an impractical solut开发者_Go百科ion.
How can I speed up the default emulator?
Android Emulator Slow? I got two solutions for you..
- Optimize and upgrade your system
- Find a Junk PC, Install Android x86
Optimize and upgrade your system:
- Install latest Drivers and Updates for your System and OS
- Install latest Builds of Java, Eclipse and ADT
- Cleanup Your system for Junk/Temp Files (Usually in Windows root drive). Use tools like Ccleaner
- Ensure you atleast have 2GB of RAM, 1GB for the Emulator alone. Change the settings while creating an emulator, Disable hardware that you don't use like GPS, Gyroscope or whatever.
- Increase the Device RAM Size and Cache Partion Size
Give ample ammount of time for the Emulator to be ready
tools.android.com/recent/emulatorsnapshots try Emulator Snapshots, it works fine as well.
10-50% Boost of performance.
Find a Junk PC, Install Android x86
If you have or can afford an old PC, something like Pentium 4 1GHz or more give this a shot.
Open Up the CPU Box,
- Pull out unnecessary hardware like modems and add-in cards
- Clean it up a little bit.. Remove the Dust and all..
- Disable unwanted peripherals like Floppy, PCI, AGP,....etc in the BIOS.
- Setup in BIOS so as to boot from CD
Both SATA or PATA Work Well.
Get the Latest Stable Generic Build from android-x86.googlecode.com Here is the Latest Stable(At the time of posting) ISO of 2.2, http://android-x86.googlecode.com/files/android-x86-2.2-generic.iso
Download this ISO and Burn it to a CD. Be sure to download the Generic iso build. This build works for most of the PCs.
- Now boot the PC from this CD and install Android. Optionally You can setup an SD card during the install. I recommend setting it up straightaway.
- Boot in to android and Setup the settings within Application
+ Unknown Sources - Selected + USB Debugging - Selected + Stay awake - Selected + Allow mock locations - Selected
- Get a USB to USB type A Male Cable, Used to connect two USB ports in different PCs. Something like this,
Amazon.com usb cable
- Connect the Cable to the Developer Machine,
- Install Necessary Driver, You Should Install Google USB driver Package from SDK update Point to C:\android\google-usb_driver. A new Hardware name Android Phone will be installed.
Now type the following in terminal or command-prompt, adb devices
Now you can see your device connected to the adb. Now when you run/test/debug your application in this device.
You can also do this Virtualbox but I'm not sure about how to connect it to the adb. However look at my blog post abt installing it to virtualbox
My Experiment Setup & Result:
Boot-up-Time 13 Secs (Aug 31, 2011 - 2.3.5 Tested on PC, Boot up time is just under 8 Seconds.. Amazing...)
Time for installing an app into device Almost negligible
PC Specs Used For testing:
Pentium 4 @ 2.90GHz With HT.
915G Chipset
2GB RAM
USB Keyboard & USB Mouse
All Serial, PS2, Parallel ports were disabled.
For Photos and more please take a look at my Blog post at sree.cc ----
http://www.sree.cc/google/installing-android-in-pc-virtualbox
100% Boost of performance.
http://code.google.com/p/android-x86/downloads/list
Android 4.0 had been released. Chk out.
It's possible to run Android in a virtual machine - I've done it using the Android x86 port (http://www.android-x86.org/). You can download ISOs that can be loaded up into any decent VM software (I use VMWare on my Mac to do it).
Performance is, as you'd expect, very good. Not technically emulation or simulation, since you're actually running Android, but it's the fastest way to run Android on a PC*.
I'm not entirely convinced it's a suitable environment for development - I've actually used it for running large screen versions of apps on non-standard hardware (1080p touchscreens, etc).
At the very least, I think it's the best solution to your question: you can compile Android code, load it into the virtual machine, and run it at normal speed.
*Short of actually booting into it...
Update: Google are now providing Android emulator images that add GPU and native x86 support, so a lot of this advice is hopefully now moot!.
Android development was initially done on a desktop simulator. It has never been an official part of the release, and the code is usually published to the AOSP site in a somewhat broken state, but it's there. The feature that kept it alive was valgrind, since (until recently) that wasn't usable on ARM.
If you look at these docs and scroll down to "Working with the desktop build", you can see some instructions for using the sim-eng build to run a simple Dalvik program.
Running "simulator" launches the wxWidgets-based front-end. From there you can start the system. Source code for that, and a bit of fanciness that does run-time interception of various system calls, can be found in the source tree.
Update: the simulator was removed entirely from the sources for the Ice Cream Sandwich release, so you need to look through the 2.3 (Gingerbread) sources to see it.
Granted - Android emulator is slow. But the upside is that when you develop an app, you instantly see where it is slow/lagging, while on last-gen 1GHz+ devices this might not be apparent.
Also, when I test my apps I run them on 2G network to see the delays and where they need to be optimized. If I'd only run them on 10Mbit+ WiFi then delays would not be noticeable.
When developing you have to plan (and test) for the worst conditions, not ideal ones. So, in a sense, slow emulator is actually helpful ;)
精彩评论