Develop apps using x86 Android* 4.4 (KitKat) emulator...5. Use x86 KitKat emulator develop apps...
Transcript of Develop apps using x86 Android* 4.4 (KitKat) emulator...5. Use x86 KitKat emulator develop apps...
Develop apps using x86 Android* 4.4 (KitKat)
emulator
Introduction
Android developers normally debug their apps by hardware devices, but it is an expensive
solution for application development because there are complicated issues of fragments in
Android hardware devices and OS versions. Fortunately, x86 Android* 4.4 (KitKat) emulator
system image solves this issue for many cases. Developers can employ this emulator to debug
their apps which is handy if hardware devices are limited or unavailable.
This article has five parts: 1) Download and install ADT and JDK; 2) Configure Android SDK
Manager for Android KitKat; 3) Download and install the x86 Android 4.4 emulator system image;
4) Download and install Intel® Hardware Accelerated Execution Manager (Intel® HAXM); 5) Use
x86 KitKat emulator to develop apps.
Senior developers can skip the first four parts and just read the last one. Less-experienced
developers should read all five parts to avoid making some common mistakes in setting up and
using the emulator.
1. Download and install ADT and JDK
Developers need to download and install the Android Developer Tools (ADT) first. Please
follow the steps below.
Step1) Download ADT from http://developer.android.com/sdk/index.html. A snapshot of web
page is shown in Picture1. Click the “Download the SDK ADT Bundle for Windows” button,
highlighted with a red rectangle.
Picture1
Step2) Check the box if you agree to the terms and conditions, then click “Download the SDK ADT
Bundle for Windows”. Picture2 shows typical responses. Developers can change the bit option if
the target system is 32-bit.
Picture2
Step3) Save the file to the hard disk and then install it on your computer. Please refer to Picture3.
Picture3
After installing ADT, developers need to download and install the Java Development Kit (JDK) by
following these steps:
Step1) Access http://www.oracle.com/technetwork/java/javase/downloads/index.html and click
“Java Platform(JDK) 7u51” (marked with a red rectangle in Picture 11). Note: Oracle may post a
newer version, so be sure to download the latest one.
Picture4
Step2) If you agree to the terms in the license agreement, select “Accept License Agreement” and
click “Windows x64” item to download (Picture5).
Picture5
Step3) Save the file and then install it (Picture6).
Picture6
2. Configure Android SDK Manager for Android KitKat
The Android SDK Manager is an essential function in Eclipse*, and developers can use it
after ADT is successfully installed. The next steps will introduce how to configure Android SDK
Manager for Android KitKat.
Step1) Launch Eclipse and select “Window ->Android SDK Manager”.
Picture7
Step2) Select and install/update “Android 4.4(API 19)” package.
Picture8
Did everything successfully download and install? I hope so! But sometimes, you may have
trouble. The Android SDM Manager may give you the error: “Missing SDK platform Android, API
19,” which occurs if you have an older version of Eclipse. All you need to do is update your
version of Eclipse.
Please refer to Picture9.
Picture9
3. Download and install x86 Android 4.4 (KitKat) emulator system image
Developers need the x86 Android KitKat emulator system image to run x86 KitKat image,
and there are two methods to acquire this image. I recommend using Method1 as the Android
SDK Manager usually has the latest version. However, you can employ Method2 to find the latest
one on the Intel web site.
Method1) Download the image with the Android SDK Manager.
Step1) Launch the Android SDK Manager (refer to Picture7).
Step2) Select and install “Intel x86 Atom System Image” as Picture10 shows.
Picture10
Method2) Download the image from the Intel web site.
Step1) Go to
http://software.intel.com/en-us/articles/android-4-4-kitkat-x86-emulator-system-image.
Step2) Download and install “sysimg_x86-19_r01.zip” (refer to Picture11). Over time, this name
may change if new versions are released.
Picture11
4. Download and install Intel HAXM
Intel Hardware Accelerated Execution Manager (Intel HAXM) is a hardware-assisted
virtualization engine. By using Intel HAXM, developers can speed up Android app emulation on
their host machines. It is an option to use it with the emulator, but I strongly recommend
developers install it for debugging apps because of its great performance.
How to download and install it?
Step1) Go to
http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager.
Step2) Download “haxm-windows_r03.zip” OR “Haxm-windows_r03_hotfix.zip” if you have a
Windows* 8.1 system.
Picture12
Step3) Unpack the zip file and install it.
5. Use x86 KitKat emulator develop apps
Developers need to add x86 Android KitKat devices into the Android Virtual Device Manager
to make the emulator function well. The following steps show how to do this.
Step1) Launch the Android Virtual Device Manager, as shown in Picture13.
Picture13
Step2) Click the “New…” button to add an x86 Android KitKat device.
Picture14
Step3) Enter its name in the AVD Name field (see Picture15).
Picture15
Step4) Select "4.0” WVGA(480x800:hdpi)” in the list (see Picture16).
Picture16
Step5) Select the target for Android KitKat (see Picture17).
Picture17
Step6) For the CPU/ABI, select “Intel Atom (x86)” (see Picture18).
Picture18
Step7) Select a camera if needed in your app (see Picture19).
Picture19
Step8) Modify any of the remaining options if needed, and then click the OK button (see
Picture20).
Picture20
Step9) Select the “Intel_x86_KitKat_4.4” device and click the “Details…” button (see Picture21).
Picture21
The detailed information for this device will be shown in a dialog box (Picture22), so developers
can double check whether they are correct or not.
Picture22
Now the Android virtual device has been added, and developers can launch the emulator.
Step1) Select “Intel_x86_KitKat_4.4” and click the “Start…” button (Picture23).
Picture23
Step2) Click the “Launch” button (Picture24).
Picture24
Step3) Wait for the emulator to start or cancel it (Picture25).
Picture25
Step4) Select Front/Rear Camera if needed (Picture26).
Picture26
Step5) Android starts booting (Picture27).
Picture27
Step6) Android is ready for use (Picture28).
Picture28
Now the emulator is ready and developers can install their apps into the emulator.
How to do it? Just follow these steps.
Step1) Check whether or not the “Google USB Driver” is ready, and install it if it isn’t (Picture29).
Picture29
Step2) Use the command line, and change path to the adb folder (Picture30).
Picture30
Step3) Install app using “adb install” command. The sample apk uses the baidu package to
demonstrate how to do it (Picture31).
Picture31
Step4) Check whether or not the app has been installed in the emulator successfully (Picture32).
Picture32
Developers can use x86 KitKat emulator to debug their apps after installation, and all the
emulator commands can be found in http://developer.android.com/tools/help/emulator.html if
developers want more.
Do you want a more convenient way to install and debug apps without having to type commands
on the boring command line? Eclipse can finish installation and execution automatically. The
following steps show you how to use Eclipse to do that.
Step1) Open “Android SDK Manager” (see Picture7 if you forgot how), and download sample
codes for KitKat (Picture33).
Picture33
Step2) Open sample code files in Eclipse.
Picture34
Step3) Run sample code (Picture35).
Picture35
Eclipse will first build the sample code and then launch the x86 KitKat emulator. After that,
sample codes will be installed and executed in the emulator.
Developers should now have the sample code displayed on the emulator screen (Picture36).
Picture36
Isn’t it easy?
Developers can choose the one that’s most similar to the app they want to develop.
There are some common issues in using the emulator, so here I list a few, helpful BKMs.
How to configure the network the emulator is running in
Proxy and DNS are two common issues in using emulator, and developers can configure
them using Eclipse.
Step1) Open “Windows” menu and select “Preferences”.
Picture37
Step2) Select the “Launch” item under “Android”, and fill in default options for emulator. For
example: -http-proxy <<proxy-name>> -avd <<avd_name>> or -dns-server 10.0.2.3 for your
different requirements. If developers want more information, please refer to
http://developer.android.com/tools/devices/emulator.html#emulatornetworking and
http://developer.android.com/tools/devices/emulator.html#connecting for more options.
Picture38
How to speed up the emulator on Intel CPU/GPU
Use Intel HAXM to make the emulator execute faster on Intel CPU/GPU. Refer to Part 4:
Download and install Intel® Hardware Accelerated Execution Manager (Intel® HAXM).
How to use the camera for photos/videos
Developers can use webcam/emulated camera to capture photos and videos on the
emulator, and the task should be done in the AVD configuration. Please refer to Picture19 in
Part2: Configure Android SDK Manager for Android KitKat.
The following table maps emulator device keys to keyboard keys.
Picture39
Check these Google Android FAQs to help answer your questions.
a) http://developer.android.com/guide/faq/framework.html
b) http://developer.android.com/guide/faq/licensingandoss.html
c) http://developer.android.com/guide/faq/security.html
d) http://developer.android.com/guide/faq/index.html
Summary
This article introduces how to build an Android development environment specifically for
Intel processor-based devices. Using the x86 Android 4.4 (KitKat) emulator system image to
launch the x86 KitKat emulator. Using Intel HAXM is critical for improving the performance of the
emulator with CPU/GPU hardware acceleration. Furthermore, debugging Android apps was
shown by using ADT and the command line, and developers can choose their favorite method.
Developers will encounter different issues with the emulator, so I shared some BKMs and website
links to help young birds find their wings.
To learn more about Intel tools for the Android developer, visit Intel® Developer Zone for
Android.
Other Related Articles
http://software.intel.com/zh-cn/blogs/2013/12/17/android-android [note the language
used, say “in Mandarin”]
http://software.intel.com/zh-cn/blogs/2013/12/17/android-android-sdk-manager [note the
language used, say “in Mandarin”]
http://software.intel.com/zh-cn/blogs/2013/12/17/android-android-x86-emulator-system-i
mage [note the language used, say “in Mandarin”]
http://software.intel.com/zh-cn/blogs/2013/12/17/android-intel-haxm [note the language
used, say “in Mandarin”]
Might want to put some English language links too, maybe have 2 lists marked by language
Resources
http://developer.android.com/tools/help/adb.html
http://developer.android.com/tools/help/emulator.html
http://developer.android.com/tools/building/building-eclipse.html#RunningOnEmulatorEcli
pse
http://developer.android.com/tools/building/building-eclipse.html#AutoAndManualTarget
Modes
http://developer.android.com/tools/devices/emulator.html
Notices
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO
LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY
RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS
OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS
ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS
INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL
PROPERTY RIGHT.
UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR
INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A
SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.
Intel may make changes to specifications and product descriptions at any time, without notice.
Designers must not rely on the absence or characteristics of any features or instructions marked
"reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility
whatsoever for conflicts or incompatibilities arising from future changes to them. The information
here is subject to change without notice. Do not finalize a design with this information.
The products described in this document may contain design defects or errors known as errata which
may cause the product to deviate from published specifications. Current characterized errata are
available on request.
Contact your local Intel sales office or your distributor to obtain the latest specifications and before
placing your product order.
Copies of documents which have an order number and are referenced in this document, or other Intel
literature, may be obtained by calling 1-800-548-4725, or go to:
http://www.intel.com/design/literature.htm
Software and workloads used in performance tests may have been optimized for performance only on
Intel microprocessors. Performance tests, such as SYSmark* and MobileMark*, are measured using
specific computer systems, components, software, operations, and functions. Any change to any of
those factors may cause the results to vary. You should consult other information and performance
tests to assist you in fully evaluating your contemplated purchases, including the performance of that
product when combined with other products.
Any software source code reprinted in this document is furnished under a software license and may
only be used or copied in accordance with the terms of that license.
Intel, the Intel logo, and Atom are trademarks of Intel Corporation in the U.S. and/or other countries.
Copyright © 2014 Intel Corporation. All rights reserved.
*Other names and brands may be claimed as the property of others.