Loading native libraries and registering native methods

Native code is usually compiled into a shared library and loaded before the native methods can be called. This recipe covers how to load native libraries and register native methods.

Getting ready

Please read the recipes in Chapter 1, Hello NDK, to set up the Android NDK development environment if you haven't done so already.

How to do it…

The following steps will show you how to build an Android application that demonstrates loading native libraries and registering native methods:

  1. Start Eclipse, select File | New | Android Project. Enter the value for Project Name as NativeMethodsRegister. Select Create new project in workspace. Then, click on Next.
  2. In the next window, select the latest version ...

Get Android Native Development Kit Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.