• Home
Name
Date
Size
#Lines
LOC

..--

res/03-May-2024-54

src/com/example/jniexample/03-May-2024-2620

AndroidManifest.xmlD03-May-2024644 1515

MakefileD03-May-20241.3 KiB4629

READMED03-May-20241.2 KiB4427

native.cppD03-May-20241.8 KiB8658

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