Android Debugger - Doesn't Exist, Doesn't Connect & More

I’ve been trying pretty much all day to get the Android Debugger working with my nVidia Shield Device, but it absolutely refuses to work. What’s annoying is that I’m now so close to getting there but it just doesn’t seem to connect to the device. I’ll start at the beginning:

  • Package Game for Windows, works and runs as expected on Desktop.
  • Package game for Android DXT - Attempt to run it on the nVidia shield tablet and get a crash instantly. The Android log in Visual Studio gives me no useful information. The problem is almost certainly caused by my code since that’s the last log message that appears, but after that it’s gone.
  • Originally had a newer version of the TDP installed, 4.0 or something, since I thought I had to have that to debug Shield devices.
  • Visual Studio had NO options for debugging on Android. See thread here: Seriously... HOW do you attach the Debugger to an Android Device?! - Mobile - Unreal Engine Forums!
  • Spent ages trying to fix that, had numerous issues as per the thread above. Decided to re-install the TADP but this time STRAIGHT from the engine folder (4.8), which I think is TADP version 2.0r or something.
  • I now have an ‘Android Debugger’ option in Visual Studio (Finally!) When I hit that, it deploys to & launches the game on the Shield device.
  • Now the problem is, my breakpoints in my code go white as if the symbols aren’t being loaded or aren’t available. Additionally, it looks as though the debugger never actually manages to connect to the device, since these are the entire contents of the output window:

  • I can cause the crash by opening a specific level, as soon as I open the level the debugger calls a breakpoint but NOT in my code, instead I get something called ‘Segmentation Error’. The callstack gives me absolutely nothing, only vague memory addresses, but no functions or breakpoints that I can follow:

So that’s where I’m stuck. Honestly it’s kind of depressing that there is literally, NO documentation on how to debug Android devices. Both myself an a chap with years of experience at EA have struggled to work through this, so I have no idea how the general population are meant to work through it…

So I figure that the Segmentation Error is down to the Game crashing and the debugger hasn’t successfully attached, but I could be way off.

I really need to get this problem sorted fast, so if needs be I can send somebody a copy of the game providing it remains private?

AndroidWorks includes a new version of Nsight which works a lot better with UE4. We are including AndroidWorks installer with 4.9 instead of TADP now. This also includes the latest ndk (r10e), sdk, and build tools. There are changes in 4.9 to properly support these changes.

Since you are doing a code project, the easiest thing to do is first package your game and install it so the OBB is in place. Then, you can start the debugger with F5. You may see the SIGILL initially from libcrypto attempting to determine cpu features; this is normal. Either just continue or disable the exception in Debug->Exceptions->Android Exceptions.

Segmentation Fault in Unix standards (since Android runs on Linux) is what Access Violation is for Windows, it’s invalid memory access. And it really look like it GDB gives wrong information to VS. You sure you build your Android application in debug build (not devlopment)? because in unix-like compilers debug symbols are included in binary, but still only 3 calls in stack is little small for UE4.

Thanks Guys.

I have done both those things. I build the game in-engine for DebugGame, and deployed it to the device like I usually do then tried running the debugger, still no luck.

I also tweaked a few settings in the Project as well. Under the Android tab I checked ‘Include Debug Symbols in Package’ etc, and a few other things that looks a bit suspect.

I just find it weird that the debugger doesn’t seem to even connect to the Shield device. Glad to hear of the improvements coming in 4.9. We’re looking at having Push Notifications as well which I think are coming in 4.9. Is this stuff in the Preview builds? Perhaps it’s worth us grabbing that and seeing how we get on. This build itself is massively experimental anyway.

Yes, definitely set configuration to Debug and platform to Android (or Tegra-Android… Nsight sometimes changes the vcxproj).

Hi Chris, I just branched off and deployed using 4.9 (I can only do that through VS at the moment BTW, Packaging in 4.9 seems to be broken).

It seems to connect now, it starts the debugger and loads the game on the device. But the game immediately crashes and the log just says it ‘exited normally’.

I tried dropping in a breakpoint in the GameInstance but even that didn’t get triggered. It DID however turn red this time when the game loaded, whereas it used to stay white as if it wasn’t active.

Here’s the Log…link text

Ahhh… Just checked the Android LogCat, and now I’m getting an ‘Assertion Failed’ in ‘Generic Platform Memory.cpp’ - Line 77.

It seems like the Engine Asserts aren’t actually triggering any debug messages at all, or even any break points…

Just tried with the Unreal Flying Template, and I now get a different error. Against, looks like a Signal loss problem…

warning: .dynamic section for “C:\Users\AppData\Local\Temp\Nsight_Tegra_devices\0424814604928001c499\symbols32\system\lib\libgnustl_shared.so” is not at the expected address (wrong library or version mismatch?)

Loaded ‘libgnustl_shared.so’
warning: Could not load shared library symbols for libvrapi.so.
Do you need “set solib-search-path” or “set sysroot”?
Loaded ‘libvrapi.so’
Loaded ‘libstagefright_http_support.so’
Loaded ‘libeffects.so’
Loaded ‘libwilhelm.so’
Loaded ‘libOpenSLES.so’
Loaded ‘libUE4.so’
Program exited because of signal SIGSEGV (Segmentation fault)
The program ‘[9413] com.YourCompany.FlyingTemp’ has exited with code 0 (0x0).

The asserts aren’t triggering breaks due to FAndroidMisc::IsDebuggerPresent() in AndroidMisc.cpp always returning false. You can change this to true and you should see the debugger stopping on the asserts.

Sorry to hijack this here. I am also having trouble with the nsight debugger on my galaxy s4 here. Dont know how I should solve this withouth debugger: