Android ndk provides a series of tools to help developers quickly develop C (or C ++) dynamic libraries, and can automatically package so and Java applications into APK files. Android
Application developers can call C or C ++ local code through ndk. We know that the APK file is easily decompiled. If the program has high security requirements, you need to use ndk. If we want
In Windows, you can also develop ndk. The following describes how to configure the environment:
1.
Download and decompress the ndk zip package.
2.
Download and install make, make, and cygwin running on Windows, and enter the GCC command to check whether the installation is successful.
3.
Modify
In the. bash_profile file under/cygwin/home/xxxx, add the following two sentences (according to the specific modification in the ndk directory,/cygdrive/D/ ing to the Windows D Drive ):
Android_ndk_root =/cygdrive/D/android-ndk-1.6_r1
Export android_ndk_root
After the environment is configured, you can develop the ndk. The development of ndk is no different from the traditional JNI development. However, if the ndk environment is used, dynamic library development can be more convenient. For details about how to develop JNI, refer to many other articles.
The following uses the hello-JNI below the compilation sample as an example to illustrate how to generate a dynamic library file.
1.
Start CD to enter the hello-JNI directory, and then enter the hello-jni.c file and $ android_ndk_root/ndk-build. If it runs successfully, you will see the build <font
Color = "black" face = "> SO packet prompt information.
$ Android_ndk_root/ndk-build
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
The generated so file can be included in the android project for use.
---------------------------------------------------------------------------
GL (arui319)
Http://blog.csdn.net/arui319
<This article can be reproduced, but please keep the above author information. Thank you.>
---------------------------------------------------------------------------