I have some C++ code that I want to make into a static lib for use with Java on the Android platform. Can anyone point me to a resource that tells me how to do this? I am completely new to Java and Android.
Use The Android NDK
They have a sample
$ make APP=hello-jni — compiles hello-jni.c and outputs a shared library to /apps/hello-jni/project/libs/armeabi/libhello-jni.so
You can scroll down on Google's NDK page to get some information. You can also check the OVERVIEW.TXT in the NDK folder once you've downloaded it to see how to get started.
Generally speaking, you need to build your shared library using the NDK, then import the shared library (e.g. libExample.so) into a Java Android project. The native functions need to be declared in the Java project using the 'native' keyword. You need to explicitly load your library by adding (following my example):
static
{
System.loadLibrary("Example");
}
When you build the Java app it should punch through to your native library code when your native functions are called.