Game Development Reference
In-Depth Information
C H A P T E R 2
■ ■ ■
Compiling Native Code in Android
In this chapter, we will explore the basics of a simple native program, also known as static binary, to be
run in the device. You will also learn how to build a shared library (dynamic binary), and finally how to
call that shared library within a simple Android project. Let's get started.
Your First Native Android App
You will need an Android project to host your native application, but before you create that, you must
create an Android Virtual Device (AVD).
Creating an AVD
With version 1.5 of the SDK, Google introduced the concept of virtual devices (AVDs). An AVD is simply a
set of configuration attributes applied to an emulator image that allows the developer to target a specific
version of the SDK. The following are the basic versions of the SDK targeted by AVDs:
Android 1.1 : This target maps to the Android SDK version 1.1 R2.
Android 1.5: This target maps to the Android SDK version 1.5 R2.
Android 1.6 : This target maps to the Android SDK versions 1.6 and 2.0.
Google APIs - 1.5 or 1.6 : This target must be used if you are building an application
that uses Google APIs such as Maps and Search.
Caution In Android 1.5 and later, an AVD does not include the Google Maps API. Keep this in mind if you are
building a maps-enabled app. Your map application will not start in an Android 1.5 AVD.
Let's create an AVD to target an SDK 1.5 for the sample application.
1.
In Eclipse Galileo, click the black phone icon on the Android toolbar (see
Figure 2-1). This opens the Android Virtual Devices Manager dialog box.
Search WWH ::




Custom Search