I have a simple question, but very specific.
I built in a c++ project (non-android) a shared library .so which I'm using for others projects.
I want to use it now to develop an Android app with Android NDK. In the /app/src/main/jni folder, I have the cpp file and I would like to use the functions of my library. Here the content of the .cpp file
#include <string.h>
#include <jni.h>
#include <mysharedlibrary.h>
jstring
Java_com_example_nativeapp_MyActivity_stringFromJNI( JNIEnv* env,
jobject thiz ) {
ObjectFromSharedLibrary obj;
functionFromSharedLibrary(obj);
...
}
But I really don't know how to do it. I spent the last 2 day looking for an answer but I found nothing
Here my environment:
- OS Linux Ubuntu 14.04 LTS
- Android studio 1.5
- Gradle 2.8
- my .so is located in /usr/local/lib and *.h in /usr/local/include/mysharedlibraryname/
I want to know if it's possible and how to do it properly from scratch.
Thanks in advance