본문 바로가기

Mobile/Android

이클립스에서 NDK 디버깅하기

출처 : http://mooyou.tistory.com/52


1. CDT 설치
The NDK plugin currently works with CDT 7.0.2 or CDT 8.0.2.
    1. Download Eclipse for Java.
    2. Install CDT from Eclipse update site http://download.eclipse.org/tools/cdt/releases/indigo. (indigo: 버전이름)
    3. Install Android SDK + NDK Plugins from Eclipse update site https://dl-ssl.google.com/android/eclipse/

2. NDK 플러그인 사용
1. First set the path to SDK and NDK:
    Eclipse -> Window -> Preferences -> Android -> set path to SDK
    Eclipse -> Window -> Preferences -> Android -> NDK -> set path to the NDK

2. Right click on an Android project and select `Android Tools -> Add native support`.
Note that you will not be able to add native support if the project already has C/C++ nature.

At this point, you will be able to build your applications using Project -> Build All.

3. NDK 디버깅
1. Update your build config to include NDK_DEBUG = 1.
    Right click project -> properties -> C/C++ Build:
2. Set a breakpoint in your C code. 3. Right click on your project, select Debug As -> Android Native Application Note: There is a delay of a few seconds between when the activity is launched and when native debugging starts. If your code is already executed by that point, then you won’t see the breakpoint being hit. So either put a breakpoint in code that is called repetitively, or make sure that you call JNI code after you see that ndk-gdb has connected.

4. 이클립스 환경설정
Eclipse -> Window -> Preferences -> C/C++ -> Code Analysis
Syntax and semantic Errors 체크 해제 (체크 해제 안할 경우 구문에러 인식하여 빌드되지 않습니다.)


참조: http://tools.android.com/recent/usingthendkplugin