Ndk environment setup instructions.
1. Download and install cgywin.
Http://www.cygwin.com/
Note:
Gcc/make/Vim/patch is required
2. Download ndk for Windows.
3. install and configure ndk.
Modify the environment variable of cgywin.
C: \ cgywin \ home \ User
Ndk =/cygdrive/e/dev/Android-SDK/android_ndk_r5c
Export ndk
Path = $ ndk: $ path
Export path
4. Verify JNI installation.
Go to the JNI directory of the hellojni Project
Run ndk-build.
Then go to libs to check. So
Package the APK to the simulator and run hellojni.
Debug ndk-Logi
Why do I need Logi? JNIProgramOne of the main debugging methods is printing, and printf does not know where to print it.
Logw is not convenient, see the URL http://www.cnblogs.com/MarsGG/articles/2057433.html below
Sprintf (szbuff ....);
Logw (szbuff ....);
It is very convenient for Logi to use printf. How can I support Logi?
Handle the following in Android. mk:
Ifeq ($ (host_ OS), Windows)
# Ndk Environment
Local_ldlibs: =-llog
Else
# Full source code Environment
Local_shared_libraries: = libutils
Endif
C'sCodeAdd the following macro to the header file.
# Ifndef _ ndk_build _
# Include <utils/log. h>
# Else
// # Define Logi printf
# Include <Android/log. h>
# Define Logi (...) _ android_log_print (android_log_debug, log_tag, _ va_args __)
# Endif
From http://blog.csdn.net/win2k3net/article/details/6618840