In
1 ). Add it by yourself: Aygwin
2) perform JNI. Import
3) customize
4) JNI
5)
/**
* After the android project is released, it is decompiled and cracked to define the Web Service interface address and parameters,
* Therefore, it is necessary to encrypt the transmitted data. Considering the problem of decompilation in Java code, Android NDK is used for the final implementation,
* Uses the NDK to call the encryption algorithm written in C language to generate an MD5 verification code,
* Considering that SO written in C is stolen (SO files are directly referenced into the project), the C language is used to call Java code for caller Identity confirmation.
*/
Static
{
System. loadLibrary ("hello-jni ");
}
Load local
Decompress android-ndk-r5c-windows.zip
Decompress cygwin package.rar
Cygwin
Run
Set
Location of the installation program
Select only
Cygwin
Required
Home
D: \ ndk \ cygwin \ home \ username \. bash_profile (username) two rows below
NDK =/cygdrive/d/android-ndk-r5c-windows/android-ndk-r5c (d)
Export NDK
Home
After installation, add the following two lines to the. bash_profile file under \ cygwin \ etc \ skel \.
NDK =/cygdrive/d/android-ndk-r5c-windows/android-ndk-r5c
Export NDK
Then copy to some reboot
Test
Double-click cygwin
$ Cd $ NDK
Display
Write
View in D: \ android-ndk-r5c-windows \ android-ndk-r5c \ samples \ hello-jni \ hello-jni.c
Generate
Tttadasdfdsfdsafd @ zjj ~
$ Cd $ NDK
Tttadasdfdsfdsafd @ zjj/cygdrive/d/android-ndk-r5c-windows/android-ndk-r5c
$ Cd samples
Tttadasdfdsfdsafd @ zjj/cygdrive/d/android-ndk-r5c-windows/android-ndk-r5c/sample
S
$ Cd hello-jni
Tttadasdfdsfdsafd @ zjj/cygdrive/d/android-ndk-r5c-windows/android-ndk-r5c/sample
S/hello-jni
$ NDK/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
In
Set
In
Use
Protection Code
Code reuse.
C
You can manually allocate memory, such as videos.