Android Native Development Kit Cookbook
eBook - ePub

Android Native Development Kit Cookbook

  1. 346 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Android Native Development Kit Cookbook

Book details
Book preview
Table of contents
Citations

About This Book

In Detail

Building Android applications would usually mean that you spend all of your time working in Java. There are however times when this is not the most efficient or best method for the application being built. This is where Android NDK comes in. Android NDK allows the developer to write in Native C/C++, giving you the power to reuse code and libraries and also, in most cases, increase the speed and efficiency of your application.

The "Android Native Development Kit Cookbook" will help you understand the development, building, and debugging of your native Android applications. We will discover and learn JNI programming and essential NDK APIs such as OpenGL ES, and the native application API. We will then explore the process of porting existing libraries and software to NDK. By the end of this book you will be able to build your own apps in NDK apps.

"Android Native Development Kit Cookbook" begins with basic recipes that will help you in the building and debugging of native apps, and JNI programming. The recipes cover various topics of application development with Android NDK such as OpenGL programming and Multimedia programming. We will begin with a simple recipe, Hello NDK, before moving on to cover advanced topics with recipes on OpenGL ES that focus on 2D and 3D graphics, as well as recipes that discuss working with NDK and external APIs. If you are looking for ways to make your application available in Android and take measures to boost your application's performance, then this Cookbook is for you.

Approach

This book is written in a Cookbook style, beginning with recipes which focus on helping developers make their software/application available in Android.

Who this book is for

Android developers who want to learn Android NDK programming, or develop multimedia and games in Android NDK will benefit from this book.

Frequently asked questions

Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Android Native Development Kit Cookbook by Feipeng Liu in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in C. We have over one million books available in our catalogue for you to explore.

Information

Year
2013
ISBN
9781849691505
Edition
1

Android Native Development Kit Cookbook


Table of Contents

Android Native Development Kit Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Hello NDK
Introduction
Setting up an Android NDK development environment in Windows
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
Setting up an Android NDK development environment in Ubuntu Linux
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
Setting up an Android NDK development environment in Mac OS
Getting ready
How to do itā€¦
How it worksā€¦
Updating Android NDK
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
Writing a Hello NDK program
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
2. Java Native Interface
Introduction
Loading native libraries and registering native methods
Getting ready
How to do itā€¦
How it worksā€¦
Passing parameters and receiving returns in primitive types
Getting ready
How to do itā€¦
How it worksā€¦
Manipulating strings in JNI
Getting ready
How to do it
How it worksā€¦
There's moreā€¦
Managing references in JNI
How to do itā€¦
How it worksā€¦
There's moreā€¦
Manipulating classes in JNI
Getting ready
How to do itā€¦
How it worksā€¦
Manipulating objects in JNI
Getting ready
How to do itā€¦
How it worksā€¦
Manipulating arrays in JNI
Getting ready
How to do itā€¦
How it worksā€¦
Accessing Java static and instance fields in the native code
Getting ready
How to do itā€¦
How it worksā€¦
Calling static and instance methods from the native code
Getting ready
How to do itā€¦
How it worksā€¦
Caching jfieldID, jmethodID, and referencing data to improve performance
Getting ready
How to do itā€¦
How it worksā€¦
Checking errors and handling exceptions in JNI
Getting ready
How to do itā€¦
How it worksā€¦
There's more...
Integrating assembly code in JNI
Getting ready
How to do itā€¦
How it worksā€¦
3. Build and Debug NDK Applications
Introduction
Building an Android NDK application at the command line
Getting ready
How to do itā€¦
How it worksā€¦
There's more...
Taking screenshots from the command line
Building an Android NDK application in Eclipse
Getting ready
How to do itā€¦
How it works...
Building an Android NDK application for different ABIs
Getting ready
How to do it...
How it worksā€¦
Building Android NDK applications for different CPU features
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
More about CPU feature detection
Different approaches of building for different cpu features
Debugging an Android NDK application with logging messages
How to do itā€¦
How it works...
Debugging an Android NDK application with CheckJNI
How to do it...
How it works...
Debugging an Android NDK application with NDK GDB
Getting ready
How to do it...
How it works...
Debugging an Android NDK application with CGDB
Getting ready
How to do it...
How it works...
Debugging an Android NDK application in Eclipse
Getting ready
How to do it...
How it works...
There's more...
4. Android NDK OpenGL ES API
Introduction
Drawing 2D Graphics and applying transforms with the OpenGL ES 1.x API
Getting ready
How to do it...
How it works...
OpenGL ES rendering display through GLSurfaceView
Drawing objects at OpenGL ES
Colors at OpenGL ES
OpenGL ES transformation
Drawing 3D graphics and lighting up the scene with the OpenGL ES 1.x API
Getting ready
How to do it...
How it works...
Mapping texture to 3D objects with the OpenGL ES 1.x API
Getting ready
How to do it...
How it works...
There's more...
Drawing 3D graphics with the OpenGL ES 2.0 API
Getting ready
How to do it...
How it works...
OpenGL Shading Language (GLSL)
How to use shader:
There's more...
Displaying graphics with EGL
Getting ready
How to do it...
How it works...
Window management
There's more...
5. Android Native Application API
Introduction
Creating a native activity with the native_activity.h interface
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
Creating a native activity with the Android native app glue
Getting ready
How to do itā€¦
How it worksā€¦
Managing native windows at Android NDK
Getting ready
How to do itā€¦
How it worksā€¦
Detecting and handling input events at Android NDK
Getting ready
How to do itā€¦
How it worksā€¦
Accessing sensors at Android NDK
Getting ready
How to do itā€¦
How it worksā€¦
Managing assets at Android NDK
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
6. Android NDK Multithreading
Introduction
Creating and terminating native threads at Android NDK
Getting readyā€¦
How to do it...
How it works...
Build with pthreads
Thread creation
Thread termination
Synchronizing native threads with mutex at Android NDK
How to do it...
How it works...
...

Table of contents

  1. Android Native Development Kit Cookbook