1, the installation make build tool
Execute the following command:
sudo apt-get install build-essential
2, download NDK
Official website download page: http://developer.android.com/tools/sdk/ndk/index.html
Select Linux 32/64-bit (x86) version, download
After a successful download, unzip to / usr / lib / directory
3, configure Eclipse plug-ins
a) development environment SDK structures, refer to: [Development] Learning Android NDK build Android SDK development environment (Ubuntu 12.04 LTS 32-bit)
Open Eclipse, NDK set path, Window -> Preferences -> Android -> NDK
b) Right-click on the project, Android Tools -> Add Native Support
Premise: Eclipse ADT successfully installed
4, debugging
a) updating C / C ++ Build configuration
Right-click on the project, Properties -> C / C ++ Build -> Builder Settings
Builder Command, from the "ndk-build" add parameter "NDK_DEBUG = 1"
In NDK r5, ndk-build has been modified to make it easier to switch between release and debug builds. This is done by using the NDK_DEBUG variable. For example: $NDK/ndk-build NDK_DEBUG=1 => forces the generation of debug binaries $NDK/ndk-build NDK_DEBUG=0 => forces the generation of release binaries If you don't specify NDK_DEBUG, ndk-build will keep its default behaviour, which is to inspect the AndroidManifest.xml, if any, and see if its <application> element has android:debuggable="true". IMPORTANT: If you use the build tools of SDK r8 (or higher), you won't need to touch your AndroidManifest.xml file at all! That's because if you build a debug package (e.g. with "ant debug" or the corresponding option of the ADT plugin), the tool will automatically pick the native debug files generated with NDK_DEBUG=1. Also, as a convenience, the release and debug object files generated by the NDK are now stored in different directories (e.g. obj/local/<abi>/objs and obj/local/<abi>/objs-debug). This avoids having to recompile all your sources when you switch between these two modes (even when you only modified one or two source files).
b) Right-click the project, Debug As -> 3 Android Native Application
Reproduced in: https: //www.cnblogs.com/dyingbleed/archive/2012/10/07/2714023.html