Debugging Unreal Engine 4 on Android

Hello,

I’m trying to use nSight with Unreal Engine 4 but having no success. I somehow managed to get it working part-way. By pure chance. But I’m getting an error when attempting to debug. It get’s to the point where it attempts to start the GDB Server and it returns the following error:

“Failed to attach: Index was outside the bounds of the array…”

Is there any official documentation/tutorial on how to integrate with UE4?

Many Thanks

Dann

Hi Dann,

This vague error message has already been fixed in the upcoming release. Unless you have a different problem, it should really say “The APK is not debuggable”. So please check that the APK that you’re trying to debug is indeed debuggable.

Hey,

I’m seeing the same message when trying to debug from Visual Studio using my own engine.

“Failed to attach: Index was outside the bounds of the array…” at the “Starting GDB” stage of the deployment. As far as I can tell I have everything set up correctly in the project settings, I just recently upgraded to the very latest version of the Tegra Android SDK installer, is there anything I should check to try to remedy?

If I deploy without debugging the application runs OK.

Thanks

Hi Maddius,

Please make sure that your APK is debuggable. The error message you’re getting usually means that it isn’t. Unfortunately, current Nsight Tegra is not very clear about it.

Hi All,

I’m getting the same error trying to debug one of the NVidia sample apps(native_basic). I’m using the Debug configuration of the solution and I’m also setting android:debuggable to “true” in the manifest.
I’ve tried a number of devices with no luck.
Is there any way I can get more info on what is going wrong?

Cheers.

Hi,

I’ve sent you my email address in a PM. I can take a look on your logs and try to find the source of the issue. The log files are in %AppData%\NVIDIA Corporation\Nsight Tegra\Logs. Please attach the most recent one or close VS, delete this folder, open VS again, reproduce the issue and send the only file that will be generated in that folder.

It became known that this error message can also mean that your device has a “run-as” issue and cannot be used for debugging. The issue is described here: https://code.google.com/p/android/issues/detail?id=58373 and can also happen on vendor devices newer than 4.3.

I am having a similar issue (but not quite the same). Trying to debug UE4, TADP 3.0r4, Win8.1 x64. ABI 19. Using Note4, Android 4.4.4. It is unable to start gdbserver. The error in the tegra log is as follows:

2015-01-18 16:59:56.9706|WARN|Nvidia.PentaK.Debug.Interop.Gdb.GdbServer|Failed: run-as: exec failed for /data/local/tmp/gdbserver Error:Permission denied
2015-01-18 16:59:56.9706|INFO|Nvidia.PentaK.Core.RedirProcess|98-launch: C:\NVPACK\android-sdk-windows\platform-tools\adb.exe "-s 8d7864fa shell cat /data/local/tmp/gdbserver | run-as com.epicgames.VehicleGearVR sh -c 'cat > /data/data/com.epicgames.VehicleGearVR/gdbserver'"
2015-01-18 17:00:06.9822|INFO|Nvidia.PentaK.Core.RedirProcess|98-timeout: was running for 10015 ms
2015-01-18 17:00:06.9822|INFO|Nvidia.PentaK.AndroidPackage|[AndroidPackage] Mode changed to DBGMODE_Design
2015-01-18 17:00:11.4013|INFO|Nvidia.PentaK.Core.RedirProcess|98-stdout:
/system/bin/sh: can't create /data/data/com.epicgames.VehicleGearVR/gdbserver': Permission denied
/system/bin/sh: cat: <stdout>: Broken pipe

The tegra log and logcat are here: https://drive.google.com/file/d/0BwFSNTriTBmjYzB1UWpsMXM4bUk/view?usp=sharing
Any ideas what’s wrong?

P.S. The phone is not rooted.
P.P.S. ls -l:

drwxrwx--x system   system            2015-01-18 04:43 data

Hi Artyom,

We have implemented a fix that might help with your issue or at least make the failure reason more clear. The build is not yet publicly available, but I can send it to you if you would like to try it out. Check your PM for my email address - send me a message and I’ll send you back the installer.

Thanks a lot, Dmitry. The version 15021 of Nsight Tegra 2.0 works with 3.0r4 and Note4!

Sorry for the delayed reply, I didn’t get notified of any responses! Sorry.

Is there an update I can try for my device as well? It is a Galaxy S4 so could be hitting the run as issue as you mentioned before. Thanks

We’re planning on releasing an updated Nsight Tegra 2.0 version soon. However, please note that the issue with your device might be different (since it’s S4, not Note4). Generally, debugging with Nsight Tegra (or any other native debugger, for that matter) won’t work if your device’s OS doesn’t have a fix for https://code.google.com/p/android/issues/detail?id=58373 merged. This is known to be the case for some of the vendor devices even if the used Android build is newer than 4.3.

OK, thanks for the info - i’ll keep an eye out for the update.

In the meantime are there any logs I could comb to see for more detailed information?

Thanks

The logs are written to %AppData%\NVIDIA Corporation\Nsight Tegra\Logs.