Can't attach MVS 2015 debugger to Android device

Hi everyone, I followed the “Set up Android” steps from the documentation, using the version of AndroidWorks that ships with the engine but I can´t seem to be able to debug the application once it´s launched on my Android phone . Here are the steps I take to deploy my C+±based game to the device:

  • Visual Studio: Build configuration DebugGame Editor - Win64

  • Run the UE4 editor

  • UE4 editor: Package the game using File > Package > Android

  • Install the game in my Android Device

  • Activate the Wait for Debugger to attach option with the matching game

  • Visual Studio: Kill the UE4 editor with the “stop debugging” button.

  • Visual Studio: Build configuration DebugGame Editor - Android

  • Select Debug → Step Into. (VS prompts again for out of date build, choosing to rebuild or not has no effect on the result)

  • Tegra for Visual Studio startup dialog does not appear and it simply does nothing

  • I go into Debug->Attach to Process and choose:

  • Transport: Nsight Tegra.

  • Qualifier: Oneplus.

  • Process: com.example.game

  • Tegra for Visual Studio just gives me an error indicating it can´t connect

I have tried to connect to My Oneplus X but it seems impossible.

Please do help me a little bit with this.

Hello ,

Visual Studio 2015 does not currently have the capability to debug for Android at this time. If you wish to debug Android projects, you’ll need to use Visual Studio 2013. We do currently have plans to add 2015 support for this which is in our system under the number UEPLAT-266.

Also to use 2013, if you aren’t already, you’ll need to use a version of the engine built from source. You can find more information about another user’s experience attempting to use this as well here: How do we re-enable Android Debugging in 4.10? - Feedback & Requests - Epic Developer Community Forums

Is this still the case? Everything looks good in VS2015 except the GDB server startup.

215072-gdbstartup.jpg

I can log but debugging is gonna be a sloooow process this way! :slight_smile:

Hello theonecalledtom,

I haven’t been able to get it to work myself, but I am told that VS2017’s Microsoft Debugger can be used if you include the -vsdebugandroid command in your GenerateProjectFiles.bat. What device are you trying to debug, and are you trying to debug CPU or GPU?

Hi , Thanks for your response.

I’m trying to debug the CPU on a Pixel XL. Looks like 99% or my code is behaving as expected on Android but getting the last 1% working using logging only will be painful. Guess I’ll try VS 2017.

Now getting the following error when I try to run / build the DebugGame Android sku:

33>PLATFORM_ANDROID_NDK_VERSION = 120200
33>NDK toolchain: r12b, NDK version: 24, GccVersion: 4.9, ClangVersion: 3.8.256229
33>Compiling Native code with NDK API ‘android-24’
33>EXEC : error : System.UnauthorizedAccessException: Access to the path ‘C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r12b\sources\android\cpufeatures\cpu-features-patched.c’ is denied.
33> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

File doesn’t exist afaik - there is a cpu_features.c file. So perhaps I’m missing some followup patch on the original installation.

That was just a matter of setting permissions on the folder, followed by another one (Program Files (x86)\Microsoft Visual Studio\2017\Community\Apps\apache-ant-1.9.3\bin).

Still missing something though - I can build the android debug build but don’t have any device options. Perhaps need to reinstall tegra or something to get working in VS2017?

A reinstall of tegra nsight didn’t help - looking at their documentation I don’t see VS2017 on the supported version list. Also - looking at the VS2017 Android overview they talk about debugging the ARM platform which is not present in UE4 (Android). I guess the ARM settings would need to be transposed to Android.

Hello theonecalledtom,

I apologize for the delay but are you still experiencing this issue? If so, please let me know and I’ll attempt to continue investigating this issue. In the meantime, I’ll be marking this issue as resolved for tracking purposes.

Never did get debugging - using output to diagnose problems and it’s a bit painful. I’m still on 4.17 fwiw.

A set of official instructions on how to debug C++ on an Android device would be golden!

Debugging Android devices worked well some days ago. After a couple opterations (Updating vs2022, installing xamarin, modifying debug configuration etc,), Debug button shows Start on my project not the specific device names, and I don’t know how to get it fixed. Please help!