如果你的C++代码中出现了很多C++特有的库,例如<iostream>,<list>等,那么你还需要在jni的文件夹下添加一个Application.mk文件,文件内容为:
APP_STL := stlport_static
APP_STL := gnustl_static
我的Application.mk
APP_ABI := armeabi
APP_STL := gnustl_static #GNU STL
APP_CPPFLAGS := -fexceptions -frtti #允许异常功能,及运行时类型识别
APP_CPPFLAGS +=-std=c++11 #允许使用c++11的函数等功能
。
我的Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := TuziHelper
LOCAL_SRC_FILES := hello-jni.c fstrcmp.c Gethwaddr.cpp HttpParser.cpp Implementation.cpp Main.cpp md5.cpp \
Event.cpp ThreadImpl.cpp SystemClock.cpp Thread.cpp ThreadSchedImpl.cpp TuziPlayServer.cpp \
src_json/json_reader.cpp src_json/json_writer.cpp src_json/json_value.cpp
#RegExp.cpp StringUtils.cpp SystemClock.cpp Thread.cpp ThreadSchedImpl.cpp TuziPlayServer.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include_json/
#LOCAL_LDLIBS += -lcrystax_static -lgnustl_static -lsupc++
#LOCAL_LDLIBS += -L $(LOCAL_PATH)/../../jsoncpp/obj/local/armeabi/ -ljsoncpp
#LOCAL_LDFALGS +=-l /home/wanguofeng/Android_develop/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/thumb/libgnustl_static.a
#LOCAL_LDFLAGS += $(LOCAL_PATH)/../../jsoncpp/obj/local/armeabi/libjsoncpp.a
#LOCAL_LDLIBS += -ljsoncpp
#LOCAL_LDLIBS +=-lcrystax_static -lgnustl_static -lsupc++
include $(BUILD_SHARED_LIBRARY)