Failed to attach: GDB server could not be found on the device...

Hi~ I developed the following conditions…

PC : Window 7
IDE : Visual Studio 2013
TADP : 3.0r1
H/W : gallexy S2 (SHW-M250S)
H/W version : 4.1.2

when I proceed to debug, I got a problem the following…

Failed to attach: GDB server could not be found on the device,
/data/data/com.hs.test/lib/gdbserver. It must be included with the application…

Please Help me TT…

have you enabled Developer options>USB debugging ?
if you are sure /data/data/com.hs.test/lib/gdbserver is existed and the USB debugging is enabled, it should be the permission issue with OS.

it is an know issue with the old OS. You can update your OS to the latest.

Hi victorli,
I’ve installed TADP 3.0r1 and OS which are the latest version.
Device USB and IDE(visual studio 2013) debugging is enabled.
But I think /data/data/com.hs.test/lib/gdbserver is not existed because when I excute command : ‘adb push gdbserver /data/data/com.hs.test/lib/gdbserver’, permission is denied…

I have known TADP doesn’t need device rooting…but, Do I need to root my device ?

Hi nukeer,
You don’t need to root your device. Gdbserver should be packed into the APK by the Android tools to be installed on your device - you don’t need to do that manually. How do you build your APK?

Thank you for your reply, Dmitry.
If you mean debug or release mode, it is debug mode of course.
And I built APK as followed.

  1. Created a Cocos2d-x Project by Visual Studio 2013

  2. In this project, added new project by followed process
    : Visual Studio 2013 -> FILE -> New -> Project -> Import a Makefile-based Android Project

  3. Closed Visual Studio And built it by Android Makefile, command line.

  4. Opened Visual Studio And Excuted debugging.

  5. NVIDIA Debugging status window pop up

  6. Deploying application – OK
    Launching application – OK
    Pulling/system/lib – OK
    Starting GDB server – NG (Failed to attach: GDB server could not be found on the device)

You can understand my problem more easily by checking below link. It is exactly same case of mine

Hi nukeer, it looks like the Cocos2d-x guys screwed up something in their that prevents debugging. If you change your to read only:

APP_ABI := armeabi-v7a
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -fsigned-char -gdwarf-3

Then do a clean, and build again. It works. I’ve toggled between the default-generated and this one (which is from one of the old 3.0 releases), and this fixes the problem.

Full debug support should work. The Nvidia team might find it worthwhile to investigate this, it looks like the difference might be-- the default behavior generates an apk in its own bin/ directory, and creates an apk without a gdbserver… while with my change, it builds to the Tegra-Android/debug folder, and includes a gdbserver.

Thank you for your reply, Ajas.
I followed your direction in your reply. however it did not work…TT

Please Check my

#APP_STL := c++_static

APP_ABI := armeabi-v7a
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -fsigned-char -gdwarf-3

#APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic

APP_DEBUG := (strip (NDK_DEBUG))
ifeq ($(APP_DEBUG),1)
APP_OPTIM := debug
APP_OPTIM := release

Is there any problem with this?

Thank you :)

Yes the problem is this line:

APP_DEBUG := $(strip $(NDK_DEBUG))

if you use instead:

ifeq ($(NDK_DEBUG),1)

Your debugging will work… I don’t think that code is doing what they think it’s doing.

Btw, I have found a generally nicer debugging experience removing the NDK_TOOLCHAIN_VERSION=clang also. For instance, before leaving a function it will always move the “current instruction” to the closing brace, before jumping out, giving you the opportunity to “step into” nested function calls.

Thank you very much Ajas :)

I have tried to solve this problem for 2 weeks!

Finally You helped me to do it!

I also thanks to Dmitri and Victorli!

Thank you! :)

I am also experiencing this issue. I downloaded the latest TADP today, so it must be up to date =)

I’m using the native_accelerometer sample, and that runs fine on a Samsung Galaxy S3 (Samsung-SGH-I747)

The Google thread implies a system file as been made read only, and it can’t be changed without rooting the device? Is there a less painful workaround?