/extension-android

Example of a native extension for Android

Primary LanguageC++MIT LicenseMIT

Android Extension

50 points

This is a small example of how to implement native extensions for Android

It features .java files, .jar files, resources, and native function calls (vibration)

Resources

If you put the resources under myext/res/android/res they will be picked up as regular Android resources, and as such, they need to conform to the naming standards of Android resources

JNI

To be able to communicate between C++ and Java, you use JNI Calls. Some resources:

Build .jar Files

We've added a small example of how to build a .jar file from .java source. Simply open a command prompt and go to the java_src folder, and run the build.sh file. It requires javac which you'll get when you install the Java SE Development Kit

Note that we use the flags -source 1.6 -target 1.6 due to the fact that we support many older Android devices.

Build .a Files

To show you how to create a C++ library file on your own, we've added a small example for this. Simply open a command prompt and go to the java_src folder, and run the build.sh file. It requires that you have installed an Android SDK and NDK.

NOTE: You may have to alter your "lib_src/build.sh" script with the appropriate paths to your local android tools