I tried for a long time to marry Boost and android on the windows and tried many approaches, but still no luck. I want to create a sample program using the Boost library in android. I follow this guide here.
As shown in this tutorial, I saved my Boost lib to **** (Android NDK) \ sources \ boost_1_44_0 ****, compiled it successfully.
Then I created an Android.mk file inside sources / boost_1_44_0 and recorded every library I want to use. In this case, lib. The file libboost_date_time-gcc-mt-s-1_44.a is available in boost_1_44_0 / android / lib /
Here is the contents of the Android.mk file.
LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE:= boost_date LOCAL_SRC_FILES:= boost_1_44_0/android/lib/libboost_date_time-gcc-mt-s-1_44.a LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) include $(PREBUILT_STATIC_LIBRARY)
Now the next step is to create the Android.mk file in the project directory, inside the jni folder (this is the creation of a shared library). Here is its content.
LOCAL_PATH := $(call my-dir) include $(call all-subdir-makefiles) include $(CLEAR_VARS)
Here is the Application.mk file located in the same place, inside the jni folder. The contents of the Application.mk file are as follows:
APP_STL = gnustl_static
And finally, here is my ndkfoo.cpp file
#include <string.h> #include <jni.h> #include <stdio.h> #include <boost/date_time.hpp> using namespace boost::gregorian; void Java_com_ndkfoo_NdkfooActivity_invokeNativeFunction(JNIEnv* env, jobject javaThis) { date weekstart(2002,Feb,1); }
this program may be incorrect, but the problem is that it does not recognize headers or enhancement functions. and I always get a compilation error.
Is there something I don't see or am doing wrong? Any help could be helpful.
EDIT: This question contains everything you need to enable the Boost library in android. See my answer below for more information. Hope this also works for you.
Thank.
c ++ android boost jni
N-JOY Oct 25 '11 at 6:18 2011-10-25 06:18
source share