Ndk environment setup instructions and ndk debugging-Logi

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.