How to add openframework to an existing android studio project?


#1

I am using android studio 3.1.2 and Mac 10.12.6, does anyone know how to do it? Since I got an working example project its run with OpenGL and another libs. It also written by native code. I want to add openframework and using it instantly. Thanks

I want to have a supplement.

That sample project is using a CMakeLists.txt to import the libraries but I cannot find it in openframework android studio project. How could I do it?

Here is the CMakeLists.txt script.

cmake_minimum_required(VERSION 3.4.1)

add_library(nuitrack_gl_sample SHARED
src/main/cpp/android_main.cpp
src/main/cpp/NuitrackGLSample.cpp)

set(NUITRACK_SDK /Users/hoyin1994/Desktop/NuitrackSDK)

add_library(app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)

add_library(nuitrack SHARED IMPORTED)
set_target_properties(nuitrack PROPERTIES IMPORTED_LOCATION ${NUITRACK_SDK}/Nuitrack/lib/android/libnuitrack.so)

add_library(middleware SHARED IMPORTED)
set_target_properties(middleware PROPERTIES IMPORTED_LOCATION ${NUITRACK_SDK}/Nuitrack/lib/android/libmiddleware.so)

include_directories(${NUITRACK_SDK}/Nuitrack/include ${ANDROID_NDK}/sources/android/native_app_glue)

find_library(log-lib log)
find_library(android-lib android)
find_library(egl-lib EGL)
find_library(gles-lib GLESv1_CM)

target_link_libraries(nuitrack_gl_sample app-glue ${log-lib} ${android-lib} ${egl-lib} ${gles-lib} nuitrack middleware)

It would be grateful if anyone has idea can offer guides.

Thanks


#2

It might be easier to do in opposite way since oF is using lots of libraries.
First, make an oF project and then include another library’s headers and link.
Also depends on which library you want to work with.


#3

I am not sure how to do it, I want to import nuitrack sdk to the project.

I can build and run its android studio project, but I don’ t know how to import it.

There are .so .jar etc. file extension. I am not sure the way import and instantiate.

Does anyone have experience on this SDK or importing the other SDK written in C++?


#4

Hello Vis.

Did you get this working? I am trying to use the same library, and have the same CMakeLists.txt.

Many thanks.


#5

After many twists and turns, It did’ t work but I found another solution.

IPC, Inter process communication. I running two app at the same time,

one is OF project, one is android native project with nuitrack lib,

I send and receive the depth or skeleton data via tcp. Finally did what I want but a but clumsy.

I hope it could help you or give you some new direction or idea.


#6

What about using this addon


#7

I don’t support Android and Linux so far.
but it should be easy like download SDK, put library files (.so and .lib ?) in ofxNuitrack/libs/nuitrack/lib/android/armeabi directory. Probably ProjectGenerator automatically find libs and add it to your project file.