I believe that Android developers like to write some high-performance applications in C + +, the knowledge of C + + development of Android NDK is summarized as follows:
From the Android NDK R5 began to support the STL Port, the beginning of this version can use some of the functions of the STL library, such as vector, string to get rid of the easy to appear in the C array of uninitialized, out-of-bounds, enhance the robustness of the application. Many netizens include include <vector> such head, but still cannot compile, here you first want to check whether the current file is a. cpp suffix, and in order to use the standard library must join APP_STL: = stlport_static In the Application.mk file. Relevant correspondence also hassystem-Use the default minimal C + + runtime, which makes the resulting application small and memory-intensive, but some features will not supportstlport_static-Use STLport as a static library, which is highly recommended by the Android Development Networkstlport_shared-STLport as a dynamic library, this may produce compatibility and some of the lower versions of the Android firmware, currently not recommended for use.gnustl_static-Using GNU libstdc++ as a static library by default STLport does not support C + + exception handling and rtti, so do not show-fexceptions or-frtti, if you really need to use gnustl_static to support the features of standard C + +, However, the resulting file size will be large and run less efficiently. Support C + + exception handling, add Local_cppflags + =-fexceptions in application.mk, similarly support rtti, then add local_cppflags + =-frtti, Here Android123 again to remind you, the second said to use Gnustl static library, rather than stlport. Force recompile STLPort, add Stlport_force_rebuild in application.mk: = True to force recompile STLPort source code, for some reasons may need to modify the next STLPort library, General developers do not need to use this item. Android is currently the latest NDK version for R6, and related learning can look at the samples overall in the NDK and development on the PC is not much different.
Android NDK STL