源码及环境搭建等参见JNI Android平台之一实例(包、解决中文路径乱码、数组传入、传出) 。
使用了vector,折腾了很久也没有进入断点。有人解决了,告诉我一声,谢谢。
1、AndroidManifest.xml的Debugable设置为true
2、右键点击工程->Android Tools->Add Native Support...
3.右键点击工程->Properties->c/C++ Build
去掉Use default build command前的勾
Build command 加上NDK_DEBUG=1
4、在要调试的地方加断点
5、运行,Debug As->Android Native Applcation
没有进入断点,Console窗口显示:
warning: Could not load shared library symbols for 88 libraries, e.g. /system/bin/linker.
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().
[New Thread 18904]
[New Thread 18905]
按模拟器的返回键退出程序,点击应用程序再次进入,就会进入断点,可以调试了。
调试非常不好用,所以学会打Log很有必要。