Dubugging c++ via Eclipse on Android device
I'm having a night of real frustration trying to setup my development environment such that I can debug into my JNI code.
I followed this tutorial: Hello-gdbserver
I am seeing the following error from my bash shell when running ndk-gdb (final part of step 3 in the tutorial):
Error: Could not extract PID of application on device/emulator."
I have tried this on my emulator (Windows 7, 32bit) and my real device (Samsung Galaxy S 2) - both giving the same error.
My AndroidManifest.xml file's "Debuggable" flag is set to true. I have added the '-B V=1' parameters to the ndk-gdb script. I have added the '-g' flag to my Android.mk files.
I have also tried using the '--start' parameter with the ndk-gdb script, which does start the application (on the emulator and my real device), so I know I'm partly there.
Has anyone had this issue or can offer sugg开发者_开发百科estions to fixing it? I'm pulling my hair out trying to figure out whayt's wrong.
Many thanks, P
Holland - I eventually tracked down the problem. I'm going from memory here so this is not exact, but one of the NDK scripts calls the 'ps' command to find the PID of your applications process. The script expected the PID to be in a certain column but the value was actually found in another.
You can test this if your device is rooted: download a terminal emulator from Google play and run the 'ps' command and note which column the PUD values are in. Then find where the NDK script checks for the value snd modify the script to check the correct column.
Appologies but I cannot remember which script it was so you will need to research that yourself.
Good luck!
精彩评论