Reference: http://www.cnblogs.com/luxiaofeng54/archive/2011/08/13/2136982.html
1. Set up the android development environment:
1) JDK; 2) eclipse; 3) Android SDK; 4) install ADT;
2. Download and install Android ndk:
Http://developer.android.com/
3. Download and install cygwin:
4. Configure the ndk environment variable:
Cyngwin Bash: Go to the user directory, open the. bash_profile file, and add
Ndk =/cygdrive/e/android-ndk-r5 (ndk =/cygdrive/<your drive letter>/<Android ndk directory>)
Export ndk
5. Configure the C/C ++ compiler in eclipse
1. Open eclipse, right-click the project name, and click Properties to bring up the configuration interface. Then, click builders to bring up the compilation tool list of the project. Then, click New to add a new compiler, click next to the Add interface. Select Program and click OK;
2. The add interface appears. First, name the compilation configuration, for example, c_builder.
Set location to <your cygwin installation path> \ bin \ bash.exe program, for example, E: \ cygwin \ bin \ bash.exe, and set working directory to the <your cygwin installation path> \ bin directory, example: e: \ cygwin \ bin
Set arguments
-- Login-c "CD/cygdrive/I/javaworkspace/blog/ndk_02 & $ ndk/ndk-build"
In the above configuration,/cygdrive/I/javaworkspace/blog/ndk_02 is the directory of the program to be compiled, and $ ndk is the environment variable of the previously configured ndk, these two parameters are configured based on your specific installation directory. Other parameters do not need to be changed. The parameters of arguments are actually passed to the bash.exe command line program to enter the program directory to be compiled, then run the ndk-build Compilation Program
3. Switch to the refresh tab and hook refresh resources upon completion;
4. Switch to the build options tab and check the last three items;
5. Click specify resources, select the Resource Directory, and select your project directory.
6. Click "finish" and click "OK" to save the configuration. Note: If the compiler you configured is under another compiler, remember to set it to the first place by clicking the "up" button, otherwise, the compilation of C code is later than that of Java code, which may cause your C code to be compiled twice before you can see the latest changes.
Note: ndk_project_path:
Arguments configuration, CD to project path.