Connect Nexus One to Mac running Snow Leopard. Run "debug" from Eclipse. Shows the execution of
/usr/local/android-ndk-r5b/ndk-build NDK_DEBUG=1
Loads on Nexus One fine. Then I try to run the debugger so I can ge开发者_JAVA技巧t to the JNI layer:
$ $NDK_DIR/ndk-gdb
Fails with these msgs:
Invalid attribute name:
package
Invalid attribute name:
package
Invalid attribute name:
package
ERROR: Non-debuggable application installed on the target device.
Please re-install the debuggable version!
So I checked the apk in bin and it has
lib/armeabi/gdbserver
Looked at the ndk-dbg script, and this message means it's failing trying to find gdbserver on the phone. So I tried to do some ls commands by hand :
$ adb shell ls /data
opendir failed, Permission denied
So I looked at /data and the permissions are 771.
What have I done wrong to get to this point?
The AndroidManifest.xml file had Windows carriage control (\r\n) which was messing up the ndk-gdb script. To fix this, I edited the file in vi and did a "set filetype=unix"
.
Another workaround is to push libs/armeabi/gdbserver to /data/data/your.pkg/lib on a rooted device.
精彩评论