Preface

Since its first release in 2008, Android has become the largest mobile platform in the world. The total number of apps in Google Play is expected to reach 1,000,000 in mid 2013. Most of the Android apps are written in Java with Android Software Development Kit (SDK). Many developers only write Android code in Java even though they are experienced with C/C++, without realizing what a powerful tool they are giving up.

Android Native Development Kit (NDK) was released in 2009 to help developers write and port native code. It offers a set of cross-compiling tools and a few libraries. Programming in NDK offers two main advantages. Firstly, you can optimize your apps in native code and boost performance. Secondly, you can reuse a large number of existing C/C++ code. Android Native Development Kit is a practical guide to help you write Android native code with NDK. We will start with the basics such as Java Native Interface (JNI), and build and debug a native app (chapter 1 to 3). We will then explore various libraries provided by NDK, including OpenGL ES, Native Application API, OpenSL ES, OpenMAX AL, and so on (Chapters 4 to 7). After that, we will discuss porting existing applications and libraries to Android with NDK (Chapters 8 and 9). Finally, we will demonstrate how to write multimedia apps and games with NDK (Bonus chapters 1 and 2).

What this book covers

Chapter 1, Hello NDK, covers how to set up an Android NDK development environment in Windows, Linux, and MacOS. We will write a "Hello NDK" application at the end of the chapter.

Chapter 2, Java Native Interface, describes the usage of JNI in detail. We will call native methods from the Java code and vice versa.

Chapter 3, Build and Debug NDK Applications, demonstrates building native code from a command line and Eclipse IDE. We will also look at debugging native code with gdb, cgdb, eclipse, and so on.

Chapter 4, Android NDK OpenGL ES API, illustrates OpenGL ES 1.x and 2.0 APIs. We will cover 2D drawing, 3D graphics, texture mapping, EGL, and so on.

Chapter 5, Android Native Application API, discusses Android native application APIs, including managing native windows, accessing sensors, handling input events, managing assets, and so on. We will see how to write a pure native app in this chapter.

Chapter 6, Android NDK Multithreading, depicts Android multithreading API. We will cover creating and terminating native threads, various thread synchronization techniques (mutex, conditional variables, semaphore, and reader/writer lock), thread scheduling, and thread data management.

Chapter 7, Other Android NDK API, discusses a few more Android libraries, including jnigraphics, the dynamic linker library, the zlib compression library, the OpenSL ES library, and the OpenMAX AL library.

Chapter 8, Porting and Using Existing Libraries with Android NDK, describes various techniques of porting and using existing C/C++ libraries with NDK. We will port the boost library at the end of the chapter.

Chapter 9, Porting Existing Applications to Android with NDK, provides a step-by-step guide for porting an existing application to Android with NDK. We use an open source image resizing program as an example.

Bonus Chapter 1, Developing Multimedia Applications with NDK, demonstrates how to write multimedia applications with the ffmpeg library. We will port the ffmpeg library and use the library APIs to write a frame grabber application.

Bonus Chapter 2, Developing Games with NDK, discusses writing games with NDK. We will port the Wolfenstein 3D game to show how to set up game display, add game control, and enable audio effects for a game.

You can download the bonus chapters from http://www.packtpub.com/sites/default/files/downloads/Developing_Multimedia_Applications_with_NDK.pdf and http://www.packtpub.com/sites/default/files/downloads/Developing_Games_with_NDK.pdf.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset