1. Download The ndk and decompress it.
2. Install cywin
: Http://cygwin.com/
Cygwin is a Linux simulated environment. Android ndk development currently does not support directly compiling C language files under windwos. Android is a Linux kernel-based system. For more information about the installation process, see cygwin. The required component gun make 3.81 or the updated version must be used to compile the c file. If you are not familiar with Linux, simply install all the components in the devel directory. You can also download the Components Package of the platform to your local device for installation. For more information, see.
Install cygwin. bat will display a command line window for Linux Shell. Test the GNU make version: Make-V. If the window shows the GNU make version (eg: GNU make 3.8.1), the installation is successful.
3. Configure cywin and ndk
The simplest configuration method is to configure cygwin environment variables in the same way as that in windows. Configure the environment variable to only the root directory of Android ndk, assuming Android ndk root Location D:/android-ndk-r5
Android_root = D:/android-ndk-r5
Path = % android_root %
When cygwin is started, all windows environment variables are loaded by default. After configuration, you can run the ndk-build compilation command.
4. recompile hello-JNI for testing
Navigate to the hello-JNI sample folder.
$ CD $ android_root/samples/Hello-JNI (note the difference between referencing system environment variables and Windows)
Run ndk-build Compilation
$ Ndk-build
Compilation information:
Gdbserver: [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup: libs/armeabi/GDB. Setup
Compile thumb: hello-JNI <= hello-jni.c
Sharedlibrary: libhello-jni.so
Install: libhello-jni.so => libs/armeabi/libhello-jni.so
$ Ndk-buildgdbserver: [arm-linux-androideabi-4.4.3] libs/armeabi/gdbservergdbsetup: libs/armeabi/GDB. setupcompile thumb: hello-JNI <= hello-jni.cSharedLibrary: libhello-jni.soInstall: libhello-jni.so => libs/armeabi/libhello-jni.so
This process will compile the hello-jni.c into the. So file, to which the android ndk development environment is configured successfully.