目前我的開發環境:
- ADT - adt-bundle-windows-x86_64-20130729
- NDK - android-ndk-r9
簡單說一下 Debug NDK 的步驟
1. Eclipse Preferences
設定 Eclipse Preference | Android | NDK | NDK Location填入正確的 NDK 下載路徑
2. 設定 Project property NDK_DEBUG=1
Project Property | C/C++ Builder | Builder Settings取消 Use default build command的選項
輸入 ndk-build NDK_BUILD=1
註:Application.mk or Android.mk 都無需修改,新版的 ADT/NDK 都已經 handle 好其他的設定了
3. 設好中斷點
在 Eclipse 裡的 C/C++ code,設好中斷點,等著上鉤4. Debug As "Android Native Application"
由於目前 ADT 在 Debug 時,同一時間只能選擇 Debug Java or C/C++所以如果 Debug As "Android Application"的話,就是 Debug Java level
如果 Debug As "Android Native Application"的話,就是 Debug C/C++ level
* 問題 *
Debug 時設中斷點,可能會出現類似這樣的Error- No symbol table is loaded. Use the "file" command.