When you create a virtual
device for the Android emulator, and you emulate the ARM CPU,
those virtual devices tend to be very slow, and their animations jagged. But
you can create a much faster and smoother
virtual device by using the Intel system image. First,
you need to install the system image, and
you do this from the Android SDK manager. In
the SDK manager
dialog, locate the Atom system image, which is most recent.
As of the time of this recording, the most recently
available version was for Android 4.3, or Jelly Bean. There
was not a version available for Android 4.4, or Kit Kat. But
if you see one, you should use that one instead. I've
selected the version for Jelly Bean, it's not installed yet,
but I'm going to install it now. Additionally,
you'll need some software from Intel. If
you're working on Windows 8 or previous, or on Mac if you're working on Mountain
Lion or previous, you can use the version
that's available from within the SDK manager.
Scroll down to the bottom of the screen, and
look under extras. And
you should find Intel x86 Emulator Accelerator. I've
already installed this software, but if you haven't installed
it on your system, check that check box now. If
you're working on Windows 8.1 or later, or if you're working on Mac OS X 10.9 or
Mavericks, I recommend that you get the software for somewhere else, though. At
this point, you can continue the download in this stream.
Click the Install button, accept
whatever licenses are offered, and click the Install button again.If you're
working on Windows 8.1, or you're working on Mac OS X
10.9, Mavericks, this is where you should get the Intel software. From
this web page at software.intel.com. The
software is called the Hardware Accelerated
Execution Manager, or HAXEM for short. You'll
find versions of HAXEM for Windows and for Mac, and notice that there are hot fixes
available for Windows 8.1 and for Mavericks, OS X 10.9.
If you're working on either of those operating
systems, download the software from here. I'll
return to Eclipse, where my Atom system image is still being downloaded. Once
the download is complete, I
recommend that you close down everything, including Eclipse. Next
you'll need to install the HAXEM software. If
you're using the version that's downloaded from
within Eclipse, you'll find it here. Go
to the adt bundle folder, to SDK, and from there to extras > Intel.
And you'll find a folder named
Hardware_Accelerated_Execution_Manager. I'm
working on Windows, so I'll double click to run the executable,
and if you see a user account control dialogue click yes. If
you're running on Mac, open the DMG file,
and then run the installer from there. Follow
through the prompts until you get to the screen that asks you
how much RAM you want to allocate to the HAXEM software. I
recommend accepting the default, whatever is offered, and just
complete the installation.
I don't need to look at the documentation, so
I'll uncheck that option, and click finish. So
now I'm ready to return to Eclipse and create my virtual device. I'll
go back to my ADT bundle, then to Eclipse, and I'll run Eclipse again. Now
I'll create the virtual device. I'll go to the
menu and select Window > Android Virtual Device Manager. I'll
go to Device Definitions. Then
I'll select Nexus 4, and I'll create the AVD.
The AVD name is set by default to
AVD_for_Nexus_4_by_Google. I'll
shorten that a bit to just
AVD_for_Nexus_4, then I'll select a target. You
can choose
one of the versions of the Android SDK that you already installed. I'll
choose Android 4.3, or Jelly Bean. And
then, under CPU, I should be able to select from
either ARM or Intel Atom, and I'll choose Intel Atom. On
Windows, set the amount of RAM to 768.
If you want to experiment with SD card
storage, you
can set a reasonably sized SD card. Then check this option, Use Host GPU. That
will cause the animations in the virtual device to bevery smooth, because it
will be using your machine's graphics capability. Click
OK to create the virtual device, then select it
from the list of virtual devices and click the Start
button.
Each time you start the virtual device from
this screen, you have
the option to wipe the user data out and start afresh. This
is the first time this virtual device is being
started though, so I'll just click the Launch button. When
you click the Launch button, you should see this message: HAX is working. That
tells you that the HAXEM software is starting successfully, and
you should see that the virtual device starts
up much faster than the ARM version. When
the home screen appears, click the OK button to clear
it, and that takes you to the device's home screen.
Then experiment a bit with the animations. Go
to the application list. If
you see this screen, click OK, and click the Back button. And
you should see that everything is animating much
more smoothly than before. I
recommend that you keep this virtual device
open while you're doing your development. If
it's open, and you run an application from within Eclipse, Eclipse
should find the virtual device and launch the app automatically here. So,
I'll come back to the Eclipse screen, close the Virtual Device
Manager, and now I'm ready to create an Android project.


0 comments:
Post a Comment