Alternative Android Development Guide: Step-by-step Instructions

A. HOW TO CREATE A NATIVE ANDROID PROJECT

A1. Download and install these tools:

- Eclipse (my version is Kepler SR2) from Eclipse website,
- Android SDK from Android Developers website, (and add it to the system path)
- Android NDK from Android Developers website, (and add it to the system path)
- Android ADT (Native Development Tools) from Eclipse Martketplace
- Eclipse CDT (C/C++ Development Tooling) from Eclipse Marketplace

My workspace location is ~/dev/workspace
(Please use the same workspace name, as you will need some hard path configurations in later steps)

A2. Open Eclipse. Select New->Project…->Android->Android Application Project


A3. Write these settings:

Application Name: MyApplication
Project Name: MyApplication
Package Name: com.example.myapplication
Minimum Required SDK: API 17: Android 4.2 (Jelly Bean)
Target SDK: API 17: Android 4.2 (Jelly Bean)
Compile with: API 17: Android 4.2 (Jelly Bean)
Theme: None

Click NEXT

Create Custome Launcher Icon (yes)
Create Activity (yes)
Create Project in Workspace (yes)

Click NEXT
Click NEXT again (you can change the icon later)

Create Activity (yes) - Blank Activity

Click NEXT

Activity Name: MainActivity
Layout Name: activity_main

Click FINISH

My project folder is ~/dev/workspace/MyApplication


A4. Right-click to Project Name, select Android Tools -> Add Native Support…
Set Library Name: libMyApplication.so
click FINISH
(After this step, Eclipse will create a JNI folder under your Project directory and it will create MyApplication.cpp and Android.mk files under this Project/jni folder)


A5. Clean & Build the project


A6. Add these lines somewhere in the MainActivity:

static {
    System.loadLibrary("MyApplication");
}
private native String testJNI();

A7. Add this line to the end of onCreate method MainActivity:

Log.i("MainActivity", testJNI());

A8. Add these lines into Project/jni/MyApplication.cpp:

extern "C" {
JNIEXPORT jstring JNICALL Java_com_example_myapplication_MainActivity_testJNI(JNIEnv * env, jobject obj) {
    return env->NewStringUTF("Hello Android Native Development");
}
};

A9. Your Android.mk can stay as automatically generated. We will not touch it for now.

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE    := MyApplication
LOCAL_SRC_FILES := MyApplication.cpp

include $(BUILD_SHARED_LIBRARY)

A10. Connect your device to the computer and click Run. Check the logcat for the “Hello Android Native Development”

Note 1: You can setup a Logcat filter to see only the log lines of your app
Note 2: Check Android Developers to see how to connect a hardware device


THUS YOU ARE ABLE TO COMPILE AND RUN A NATIVE ANDROID PROJECT. I DIDN’T TOUCH THE TEXT “HELLO WORLD” ON THE SCREEN BECAUSE WE WILL CHANGE THIS LATER WHEN ADDING OF.

AFTER HERE I WILL TRY TO EXPLAIN HOW TO ADD OPENFRAMEWORKS TO THIS NATIVE ANDROID PROJECT AS A SHARED LIBRARY.

7 Likes

B. HOW TO COMPILE OPENFRAMEWORKS AS A SHARED LIBRARY

B1. Download openFrameworks Android for Eclipse from the download page:
http://openframeworks.cc/download/
I download it now, the current version is 0.8.4


B2. Unzip it somewhere (but not to desktop because you need to store it for a long time.)
I unzip it now to

~/dev/of084

(Please remember that my workspace is at ~/dev/workspace)

Now the my full path to OF’s read me file is ~/dev/of084/README.md (I give that just to prevent misunderstandings)


B3. Open the file

~/dev/of084/libs/openFrameworksCompiled/project/android/paths.make

Edit your SDK and NDK paths


B4. Open the file

~/dev/of084/libs/openFrameworksCompiled/project/android/config.android.default.mk

Go to line PROJECT_EXCLUSIONS part. Add this line to the end of project exclusions:
PROJECT_EXCLUSIONS += ./src
(Because we will add these files later to our Native Android Project)


B5. Restart Eclipse and in the beginning when it asks workspace, click browse and select

~/dev/of084/examples/android

B6. Click File->General->Existing Projects Into Workspace->
(Import here all the below folders one by one in the given order)

  • openFrameworks/libs
  • openFrameworks/libs/openFrameworks
  • openFrameworks/addons/ofxAndroid/ofAndroidLib
  • openFrameworks/examples/android/androidAssimpExample

B7. After the last import, automatical compilation of OF will start. If not, you can select androidAssimpExample from the Project Explorer window and and click the hammer button to build for Release.


B8. After the compilation, this shared library file will be generated:

~/dev/of084/examples/android/androidAssimpExample/libs/armeabi-v7a/libOFAndroidApp.so

( Ok, I choosed the easiest way to generate it :stuck_out_tongue: )

IMPORTANT NOTE: Do never delete this of084 directory. Because as you will see in the future, you will need to add some method into this shared library. Then you will open this workspace, you will add them to the shared lib and you will compile it again. I will explain this in the last part.


IN THE NEXT PART, WE WILL COPY AND PASTE THIS SHARED LIBRARY (+SOME MORE) TO OUR INITIAL NATIVE ANDROID PROJECT AS A SHARED LIBRARY.

2 Likes

C. HOW TO ADD OF TO OUR NATIVE ANDROID PROJECT AS A SHARED LIBRARY
This part is a little complex and confusing. I will try to do my best for the simplicity :slight_smile:

C1. Restart Eclipse, select the first workspace

~/dev/workspace

C2. Create this directory:

~/dev/workspace/MyApplication/lib/armeabi-v7a

(please note that the target folder is not Project/libs/armeabi-v7a but Project/lib/armeabi-v7a)


C3. Copy the the whole content of the below directory to the above one: (Thus we copy-paste the shared library to our native android project)

~/dev/of084/examples/android/androidAssimpExample/libs/armeabi-v7a

C4. In the Eclipse’s Project Explorer window; Right click to the project name and select Refresh (The new lib directory will be added to the list)


C5. In the Eclipse Project Explorer; Right click to the src (Project/src) and select New->Package.
Package Name: cc.openframeworks


C6. Copy all the files of this directory (do not copy the directory itself, but only its files):

~/dev/of084/addons/ofxAndroid/ofAndroidLib/src/cc/openframeworks

to:

~dev/workspace/MyApplication/src/cc/openframeworks

C7. In the Eclipse’s Project Explorer; right click to src and select Refresh. All the files of the new package will be added to the list.


C8. Copy all the files of this directory (main.cpp, ofApp.cpp and ofApp.h):

~/dev/of084/examples/android/androidEmptyExample/src

(please note that it is not androidAssimpExample, but androidEmptyExample!)
to:

~dev/workspace/MyApplication/jni

C9. In the Eclipse Project Explorer; Right click to jni (Project/jni) and select Refresh. The new files will be added to the list.


C10. Open Project/src/cc.openframeworks/OFAndroid.java
Add your own module to the static loader (line 1020) like that:

static {
    try{
        Log.i("OF","static init");
        System.loadLibrary("neondetection"); 
        if(hasNeon()){
            Log.i("OF","loading neon optimized library");
            System.loadLibrary("OFAndroidApp_neon");
        }else{
            Log.i("OF","loading not-neon optimized library");
            System.loadLibrary("OFAndroidApp");
        }
        System.loadLibrary("MyApplication");
    }catch(Throwable e){
        Log.i("OF","failed neon detection, loading not-neon library",e);
        System.loadLibrary("OFAndroidApp");
        System.loadLibrary("MyApplication");
    }
    Log.i("OF","initializing app");
}

C11. In Eclipse, open Project/jni/Android.mk
Change it like that:

LOCAL_PATH := $(call my-dir)
PATHlib = ../lib/$(TARGET_ARCH_ABI)

include $(CLEAR_VARS)
LOCAL_MODULE := OFAndroidApp
LOCAL_SRC_FILES := $(PATHlib)/libOFAndroidApp.so
LOCAL_CPPFLAGS  := -fexceptions -frtti
IPATH := $(LOCAL_PATH)/../../../of084/libs
IPATHof := $(IPATH)/openFrameworks
IPATHadd := $(LOCAL_PATH)/../../../of084/addons
LOCAL_EXPORT_C_INCLUDES := $(IPATHof) $(IPATHof)/utils $(IPATH)/tess2/include $(IPATH)/poco/include \
$(IPATHof)/types $(IPATHof)/math $(IPATHof)/events $(IPATHof)/3d $(IPATHof)/gl $(IPATHof)/graphics \
$(IPATHof)/app $(IPATHof)/sound $(IPATHadd)/ofxAndroid/src $(IPATHof)/video \
$(IPATHadd)/ofxAssimpModelLoader/libs/assimp/include $(IPATHadd)/ofxAssimpModelLoader/src
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := MyApplication
LOCAL_SRC_FILES := main.cpp ofApp.cpp
LOCAL_LDLIBS    := -llog -landroid -lGLESv1_CM
LOCAL_CPPFLAGS  := -fpermissive -Wuninitialized
LOCAL_STATIC_LIBRARIES := gnustl_static
LOCAL_SHARED_LIBRARIES :=  OFAndroidApp
IPATH := $(LOCAL_PATH)/../../../of084/libs
IPATHof := $(IPATH)/openFrameworks
IPATHadd := $(LOCAL_PATH)/../../../of084/addons

LOCAL_C_INCLUDES := $(IPATHof) $(IPATHadd)/ofxAndroid/libs/miniunzip/src $(IPATHof)/utils $(IPATH)/tess2/include $(IPATH)/poco/include $(IPATH)/openssl/include \
$(IPATHof)/types $(IPATHof)/math $(IPATHof)/events $(IPATHof)/3d $(IPATHof)/gl $(IPATHof)/graphics $(IPATH)/glu/include_android \
$(IPATHof)/app $(IPATHof)/sound $(IPATHadd)/ofxAndroid/src $(IPATHof)/video \
$(IPATHadd)/ofxAssimpModelLoader/libs/assimp/include \

include $(BUILD_SHARED_LIBRARY)

C12. In the Eclipse Project Explorer, right click to jni (Project/jni), select New->File
Create a file named Application.mk


C13. Copy these lines into the new Application.mk:

APP_ABI := armeabi-v7a
APP_PLATFORM := android-17
NDK_TOOLCHAIN_VERSION := 4.8
APP_STL := gnustl_static

C14. Copy the file:

~/dev/of084/examples/android/androidEmptyExample/res/layout/main_layout.xml

to

~/dev/workspace/MyApplication/res/layout/main_layout.xml

C15. In the Eclipse Project Explorer, right click to layout (Project/res/layout) and select Refresh. The main_layout.xml will be added to the list)


C16. In Eclipse; open MyApplication/com.example.myapplication/MainActivity.java


C17. In the MainActivity, Add this to the imports:

import cc.openframeworks.OFActivity;

C18. In the MainActivity, Change this line:

public class MainActivity extends Activity

to

public class MainActivity extends OFActivity

C19. In the MainActivity, delete all the test lines we previously added for test purposes:

Log.i("MainActivity", testJNI());

and

static {
    System.loadLibrary("MyApplication");
}    
private native String testJNI();

C20. In the MainActivity, delete this line:

setContentView(R.layout.activity_main);

C21. Clean & Build your project


C22. In Eclipse, open Project/jni/ofApp.cpp and add this line into setup() void:

ofLogNotice("testApp.cpp") << "Hello openFrameworks!";

C23. Run the app and check the logcat output. You should see Hello openFrameworks on the logcat.

I THINK IT WORKS NOW AS YOU NEED

Try something to test it. For example in the ofApp.h write

ofImage *testImage;

And in the ofApp.cpp, write

testImage

Then put a dot. Then Eclipse should automatically show a list of all available methods now.


It is too late here, I will continue tomorrow morning.

2 Likes

@rancs I did the set almost up as you described - I used the Luna Eclipse for C++ though, since I already had it installed. I am facing one last issue - I cannot compile the project due to the following errors:

14:05:59 **** Build of configuration Default for project MyApplication ****
/Library/AndroidDev/android-ndk-r9d/ndk-build all 
[armeabi-v7a] Compile++ thumb: MyApplication <= main.cpp
[armeabi-v7a] Compile++ thumb: MyApplication <= ofApp.cpp
[armeabi-v7a] Prebuilt       : libOFAndroidApp.so <= jni/../lib/armeabi-v7a/
[armeabi-v7a] SharedLibrary  : libMyApplication.so
jni/main.cpp:5: error: undefined reference to 'ofSetupOpenGL(int, int, int)'
jni/main.cpp:10: error: undefined reference to 'ofRunApp(ofBaseApp*)'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libMyApplication.so] Error 1

14:06:06 Build Finished (took 7s.584ms)

Imports are recognized and code completion works all classes, including ofApp.cpp, as you described - but i cannot seem to get rid of those errors in main.cpp:

int main(){
	ofSetupOpenGL(1024,768, OF_WINDOW);			// undefined reference to ofSetupOpenGL(int, int, int)

	// this kicks off the running of my app
	// can be OF_WINDOW or OF_FULLSCREEN
	// pass in width and height too:
	ofRunApp( new ofApp() );                    //undefined reference to 'ofRunApp(ofBaseApp*)'
	return 0;
}

What catches my eye here, is that it seems as it’s trying to compile libMyApplication.so but breaks in main.cpp file. In the log, it seems as though libOFAndroidApp.so prebuilds fine… So i don’t quite understand the error. Could you please elaborate on how those two files connected?

I think the problem is in the step C10 or in the Android.mk.

The compiler should first add the shared library libOFAndroidApp.so, then main.cpp in the second order.

But in your case the compiler compile first the main.cpp and it can not find the OF code because the shared library is not compiled yet.

EDIT:
The true sentence above should be like that:

The compiler should initialize; first libOFAndroidApp.so and second libMyApplication.so
Because the methods of the second one use the methods of the first one. In the case of reverse initialization order, the unloaded methods of the first one can not be found.

Please check logcat for initialization logs.

Possibility1. The first possibility, as I wrote above, initialization order. Please see the logcat for the initialization order of the libraries. The second should be linked to the first one.

Possibility2. Another possibility I can mind is;
at step B7 you couldn’t get a successfull build of the libOFAndroidApp.so shared library. Did the build stop or was it successfull? You can understand it by entering this command in the lib/armeabi-v7a folder;

nm libOFAndroidApp.so | grep ofSetupOpenGL

You should see something like that with T letter in the beginning:

002192c8 T _Z13ofSetupOpenGL5ofPtrI15ofAppBaseWindowEiii
00219430 T _Z13ofSetupOpenGLP15ofAppBaseWindowiii
002194e0 T _Z13ofSetupOpenGLiii
  1. Logcat checks out - but the guide needs to be adjusted to include the code that actually wires those libraries up - basically replacing the MainActivity code from code from any of the android examples worked for me.

  2. I think this is where the problem actually is - grep comes out empty. I am looking into the B series of steps to see if i missed anything. Thank you for your time!

Yup, I repeated the B series and it worked. I have been playing around with it and code autocomplete, etc work very well. I just have a question though - when the library gets compiled as a shared library, do all the libraries get included? I cannot seem to access things like ofxOpenCv, etc. Is it something that needs to get specified explicitly?

@Rancs - Upon further investigation, it looks that ofxOpenCv is an addon and doesn’t get bundled up in the library. I guess I can try to create another library with just that and add it too.

Great :slight_smile: You realize I think, beside all features working, the biggest advantage is the compilation speed. It is decreased from 5-10 minutes to 5-10 seconds.

No, all methods are not included. The C++ compilation does not include everything inside the shared library. It goes line by line, it checks the code and it adds only the needed parts. In the later steps we will compile a more complete shared library which includes all we needs. I am going step-by-step to make you understand how the system works. Because you will need to recompile openFrameworks in the feature yourself for additional things.

Adding ofxaddons (like ofxOpenCV) is a different subject. I will explain it too.

I will explain you all of them one by one and step by step. Just please give me 1 day. We are working on releasing an update here. Then I will write you the rest.

D. HOW TO ADD RESOURCES TO THE PROJECT

openFrameworks has a resources system:

  • Resources files must be zipped.
  • The name template of the resources file is: “appname” + “resources.zip”.
    So our app’s resources file must be myapplicationresources.zip
  • This zip file should be placed under project/res/raw folder.

D1. Now as we started from assimp example, we will take its resources. It’s resources file is here:

~/dev/of084/examples/android/androidAssimpExample/res/raw/androidassimpexampleresources.zip

D2. Copy above file and paste it to project/res/raw (if there is not a /raw folder under project/res, we create it)


D3. We rename it to

myapplicationresources.zip

D4. In the Eclipse’s Project Explorer window; Right click to the /res and select Refresh (The /raw/myapplicationresources.zip file will be added to the list)


D5. That’s all for the resources. In the start of the app, OF will automagically unzip this resources file to the

sdcard/Android/data/com.example.myapplication

directory.

1 Like

E. HOW TO HANDLE APP’S LIFECYCLE AND RUN THE FULL EXAMPLE

We didn’t something yet to handle app’s lifecycle events like pause, resume, etc…
We didn’t neither handle yet key events.

I will go from the easiest way again. We will copy and paste all the necessary code from assimp example.


E1. Open

~/dev/of084/examples/android/androidAssimpExample/srcJava/cc/openframeworks/androidAssimpExample/OFActivity.java

E2. Don’t copy package name and import lines. Don’t copy class name line and its closing bracket (the last line of the class)

Copy all the code which is inside class brackets.


E3. In Eclipse, open

project/src/MainActivity.java

E4. Delete all the code inside the class brackets. (The class name line “public class MainActivity extends OFActivity {” and its closing bracket “}” in the last line should stay)

package name and import lines should stay as well.


E5. Paste the copied code (in E2) to here.


E6. Add this import to the imports of MainActivity.java:

import android.view.KeyEvent;

E7. Now we prepared our all system. We prepared our resources. The only thing we need is the openFrameworks code to load and run the resources. We will do it again with the easiest way:

Open

~/dev/of084/examples/android/androidAssimpExample/src/ofApp.h

and copy whole file.


E8. In Eclipse; Open

project/jni/ofApp.h

Delete whole code and paste the (E7) code


E9. Open

~/dev/of084/examples/android/androidAssimpExample/src/ofApp.cpp

and copy whole file lines.


E10. In Eclipse; Open

project/jni/ofApp.cpp.

Delete whole code and paste the (E9) code


E11. Run the app


Is it ok? Can you see the app (formerly assimp example) running on the screen?

Do you have any problem like unrecognized headers, not working auto-completion, slow compilation speed, unnecessary error messages and red underlines? Is everything ok?

1 Like

F. HOW TO ADD OFXADDONS

Now we will add a simple ofxaddon into our project. I choosed ofxColorGradient for this example.

The source is here:
ofxColorGradient repo


F1. Open a /of directory under project/jni

project/jni/of

F2. Open a /ofx directory under project/jni/of
The full path to our addon directory now is:

project/jni/of/ofx

F3. Download the source pack of ofxColorGradient from Github
(I don’t clone it now. For the simplicity I download it as a zip file)


F4. Open a /ofxColorGradient directory under project/jni/of/ofx

project/jni/of/ofx/ofxColorGradient

F5. Copy the ofxColorGradient.h and ofxColorGradient.cpp files to

project/jni/of/ofx/ofxColorGradient/ofxColorGradient.h
project/jni/of/ofx/ofxColorGradient/ofxColorGradient.cpp

F6. In Eclipse Project Explorer, right click to jni and select Refresh. The files will be added to the list.


F7. In Eclipse, open project/jni/ofApp.h and add this include (I import the example code of the addon):

#include "ofxColorGradient.h"

(I don’t get any error message here. The header is recognized by Eclipse. You may get an “Unresolved inclusion” error. Continue to follow the next steps.)


F8. Yet in ofApp.h, add this definition line:

ofxColorGradient gradient;

F9. In Eclipse, open project/jni/ofApp.cpp


F10. Add these lines to the end of the setup() void (lines are from the addon example):

ofSetVerticalSync(true);
ofBackground(0, 0, 0);
//custom gradient design
gradient.addColor( ofColor::black );
gradient.addColor( ofColor::red );
gradient.addColor( ofColor::green );
gradient.addColor( ofColor::yellow );
gradient.addColor( ofColor::blue );
gradient.addColor( ofColor::magenta );
gradient.addColor( ofColor::cyan );
gradient.addColor( ofColor::white );
gradient.addColor( ofColor::black );
//empty
gradient.reset();
//or load from an image
ofImage img;
img.loadImage("falseColor.png");
gradient.loadFromImage(img, 3);

F11. Add this line to just the beginning of the draw() void (to the first line of the void):

gradient.drawDebug(0, 0, ofGetWidth(), ofGetHeight());

F12. Open

project/res/raw/myapplicationresources.zip

Add the image file falseColor.png to the main directory of the resources (take the image file from ofxColorGradient’s example).


F13. Click Run


F14. At this point I get an error message:

fatal error: ofxColorGradient.h: No such file or directory
make: *** [obj/local/armeabi-v7a/objs/MyApplication/main.o] Error 1

Altought our header is somehow recognized by Eclipse, it is not found by the compiler. And we get this error. To declare the path of the file to the compiler, we need to define it in our makefile:

project/jni/Android.mk

F15. Open

project/jni/Android.mk

F16. There is this line in the makefile:

LOCAL_SRC_FILES := main.cpp ofApp.cpp

Add of/ofx/ofxColorGradient/ofxColorGradient.cpp to the end of this line. It will be like that:

LOCAL_SRC_FILES := main.cpp ofApp.cpp of/ofx/ofxColorGradient/ofxColorGradient.cpp

So we added the source file of the addon to the project.


F17. Now we will add the header path. In the end of the Android.mk, there is this long line:

LOCAL_C_INCLUDES := $(IPATHof) $(IPATHadd)/ofxAndroid/libs/miniunzip/src $(IPATHof)/utils $(IPATH)/tess2/include $(IPATH)/poco/include $(IPATH)/openssl/include \
$(IPATHof)/types $(IPATHof)/math $(IPATHof)/events $(IPATHof)/3d $(IPATHof)/gl $(IPATHof)/graphics $(IPATH)/glu/include_android \
$(IPATHof)/app $(IPATHof)/sound $(IPATHadd)/ofxAndroid/src $(IPATHof)/video \
$(IPATHadd)/ofxAssimpModelLoader/libs/assimp/include

Add

$(LOCAL_PATH)/of/ofx/ofxColorGradient

to the end of this line. The final line will be like this:

LOCAL_C_INCLUDES := $(IPATHof) $(IPATHadd)/ofxAndroid/libs/miniunzip/src $(IPATHof)/utils $(IPATH)/tess2/include $(IPATH)/poco/include $(IPATH)/openssl/include \
$(IPATHof)/types $(IPATHof)/math $(IPATHof)/events $(IPATHof)/3d $(IPATHof)/gl $(IPATHof)/graphics $(IPATH)/glu/include_android \
$(IPATHof)/app $(IPATHof)/sound $(IPATHadd)/ofxAndroid/src $(IPATHof)/video \
$(IPATHadd)/ofxAssimpModelLoader/libs/assimp/include $(LOCAL_PATH)/of/ofx/ofxColorGradient

F18. Now go back to the project/jni/ofApp.cpp file.


F19. Clean and Build the project. Wait until the indexer finishes his job.


F20. Click Run.


F21. At this point you may have an error message. Because indexer may reindex the project. Just click OK and wait a little until the indexer finishes his job again.


F22. Reclick Run


F23. Just a note: If you get an error message for the “gradientBar[leftColor].a” variable in the line 77 of ofxColorGradient.cpp; go to the ofxColorGradient.h and change this line:

vector <ofColor>  gradientBar;

to

std::vector <ofColor>  gradientBar; //just at std:: to the beginning

Then restart from the step (F20)


Now you should see a gradient background in the app.

If yes, that’s great! You added the first ofxaddon to your project :slight_smile:


We have now a working project with an ofxaddon included.

There is a last subject I will write a howto. It is how to add the missing core classes and methods (if any) to the shared library. I will write it later and I will finish this series of the alternative project template.

1 Like

So it worked. Thank you so much for writing this tutorial! Everything about this method integrating OF with Android is much much better, this is actually a workable setup.

I am having issues integrating other addons into the project though, like ofxFaceTracker. There is ton of errors I don’t quite understand. I am almost positive it has to do with linker - there are errors in the actual ofxFaceTracker files, like

jni/of/ofx/ofxFaceTracker/libs/FaceTracker/include/FaceTracker/Tracker.h:51: error: undefined reference to 'FACETRACKER::FDet::~FDet()'

I know this is beyond the scope of this tutorial but any help would be greatly appreciated.

I think you need to add FDet.cc to Android.mk’s LOCAL_SRC_FILES line.

something like that:

LOCAL_SRC_FILES := main.cpp ofApp.cpp of/ofx/ofxFaceTracker/libs/FaceTracker/src/lib/FDet.cc

You choosed one of the most difficult ofxaddons in your first try though :slight_smile:

I look at the ofxFaceTracker code: It depends openCV. Then I look at the ofxOpenCV’s code: I see that its source code is pre-compiled.

If you are not familiar with android’s makefile system, you can not do this job with the above howtos. You need to know how to add a pre-compiled static library into a native android project. I realize now that, If you don’t know it, I should also explain this subject.

That would be so great if you could do that. I do have experience with Gradle, but not with the system used in Eclipse. I really think that these tutorials will help out a lot of people because this stuff isn’t easy to learn on your own. So thank you so much for taking your time!

I can do it with pleasure of course, but this week I’m very hard working. I doubt I can find a spare time for it.

If you are in hurry, and If you don’t know how to add a pre-compiled static library to an android project… I think the easiest and shortest way for you is; adding these 2 ofxaddons in the normal usage of openFrameworks, compiling libOFAndroidApp.so with them and then using this latest shared library in your project.

I will try to do it this way. Thanks for an advice!