README
1JNI Example
2
3This sample shows how to build a native code library, package it into an APK, and call it using JNI.
4
5Prerequesites
6
7You must install the Android SDK in order to build the Java APK. The Android SDK can be downloaded
8from
9
10http://code.google.com/android/download.html
11
12Build Steps:
13
141) Create an Eclipse project to for the Java code.
15
16 Launch Eclipse
17 Choose File : New : Project...
18 Choose Android : Android Project
19 Choose Next
20 Enter "JNIExample" into the Project name: field.
21 Choose "Create project from existing source"
22 Click the Browse button and browse to the pndk/samplejni directory
23
24 Click Finish
25
262) Build the Eclipse Project
27
28 Select the JNIExample project in the Package Explorer
29 Make sure that the menu item Project:Build Automatically is not checked.
30 Choose Project:Build
31
32 The resulting apk file ends up in bin/full/JNIExample.apk
33
342) Build the shared library, insert the shared library into the APK file and resign the
35 shared library.
36
37 ANDROID_SDK_BASE=<directory where SDK is installed> make
38
39Install the APK on the device:
40
41 adb install -r bin/full/JNIExample.apk
42
43Once the application is installed, you can run it by tapping on the "JNI Example" icon.
44