This is a simple implementation of an android calculator using NDK
** HOW TO:
Prerequisite:
-
Create a jni folder in your project
-
Paste the Calculator.c, Android.mk, Application.mk files in jni
-
Replace Java_com_example_syncocard_NativeLib_add() with Java_your_package_name_NativeLib_add() NOTE: Do this with the subtract, divide and multiply methods too.
Compiling instructions (on OSX)
-
Download the android NDK
-
Open terminal and browse to the jni folder in your project
-
Paste the below command:
/Users/MacUser/Documents/Android/android-ndk-r9d/ndk-build
NOTE: ndk-build is within the root folder of android-ndk, so you would have to browse to whatever location you have saved yours
-
Refresh project if necessary and you should see the .so files necessary to run the project.
-
Run project as Android application.
Enjoy!