操作系统:Windows8 x64
Eclipse:ADT 捆绑形式http://developer.android.com/sdk/index.html
NDK:适用于 Windows 64 的 NDK8e,来自http://developer.android.com/sdk/index.html。
我将 Windows/Preference/Android/NDK 设置为 corect NDK 路径。
我所做的:
将 hello-jni 示例从 %Android-NDK%/samples 导入到 Eclipse
在 AndroidManifext.xml 中修改
<uses-sdk android:minSdkVersion="3" /> to <uses-sdkandroid:minSdkVersion="17" />
添加本机支持
右键单击项目,Android 工具/添加本机支持。
打开调试
右键项目,Properties/“C/C++ build”/Build Settings,修改Build命令为“ndk-build NDK_DEBUG=1”
在 C 代码中设置断点。
调试为/Android 原生应用程序。
我在两台电脑上做这个。但是有两个错误信息。
一个是这样的:
[2013-06-12 00:03:09 - HelloJni] Unknown Application ABI:
[2013-06-12 00:03:09 - HelloJni] [2013-06-12 00:03:09 - HelloJni] Unable to detect application ABI's
另一个是像下面这样:
warning: Could not load shared library symbols for 73 libraries, e.g. /system/binnker.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
warning: Unable to find dynamic linker breakpoint function.
GDB will retry eventurally. Meanwhile, it is likely
that GDB is unable to debug shared library initializers
or resolve pending breakpoints after dlopen().