I.MX6 Android stlport 使用

时间:2022-07-03 09:23:27
/******************************************************************
 *                  I.MX6 Android stlport 使用
 * 说明:
 *     在移植JNI过程中使用了C++ stlport lib,而在Android源码中编译
 * 和在NDK中使用,其配置方式是不一样。
 *
 *                                2016-8-11 深圳 南山平山村 曾剑锋
 *****************************************************************/

一、参考文档:
    1. C++ Library Support
        https://developer.android.com/ndk/guides/cpp-support.html
    2. Import STL libraries to the Android NDK code
        http://www.41post.com/3527/programming/import-stl-libraries-to-android-ndk-code
    3. Android NDK 'std::string' has not been declared
        https://www.douban.com/note/261241949/
    4. 关于Android NDK如何成功调用stl的使用分析
        http://blog.csdn.net/fantasyhujian/article/details/8564198
    5. Using the STL with Android NDK C++ [closed]
        http://*.com/questions/9458208/using-the-stl-with-android-ndk-c

二、error:
    fatal error: string: No such file or directory

三、Android Source Code JNI compiler:
    cat jni/Android.mk:
        LOCAL_PATH := $(call my-dir)

        include $(CLEAR_VARS)

        LOCAL_MODULE    := libCanSocket
        LOCAL_SRC_FILES := CanSocket.cpp
        LOCAL_LDLIBS    := -llog
        LOCAL_C_INCLUDES := ndk/sources/cxx-stl/stlport/stlport
        LOCAL_STATIC_LIBRARIES += libstlport_static

        include $(BUILD_SHARED_LIBRARY)

四、NDK JNI compiler:
    cat Application.mk
        APP_STL := stlport_static
        APP_PLATFORM := android-9