baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.88k stars 1.33k forks source link

Android - Can't attach to application #3275

Closed pnill closed 6 months ago

pnill commented 6 months ago

Description

I'm simply attempting to attach render doc to my application on my phone which utilizes GLES2.0/JNI natively, when doing so render doc succeeds in installing its own application/remote server. Launches the target application (On the phone I see waiting for a debugger to attach) then eventually appears to timeout and suggests android studio or something else could be interfering in an error message despite the fact the message on the phone has went away at this point indicating it was waiting for a debugger to attach.

I've seen nothing interesting in logcat, I've been unable to reach success while trying to increase the timeouts which seem to be limited at (120), the message appears prior to the timeout it would seem too.

Android studio is not installed on the system which I'm running Renderdoc, nor running, I'm using the built-in version of ADB it provides not providing my own.

I should also note I've attempted to utilize AGI(Android Graphics Inspector) and my device isn't compatible with that, not sure if it matters here or if Renderdoc makes use of similar APIs.

Steps to reproduce

Unfortunately, there are not many steps to reproduce this as I'm not able to get started with capture and can't be much more detailed than I have been in the description of my problem.

I will say some additional steps I've taken to overcome the issue is disabling SELinux with 'setenforce 0' disabling usap as I've seen issues with it and other capture/instrumentation frameworks, this was after I initially had problems and performed these steps in attempts to get it working, all of which have failed/provided no further success.

So to be clear, this also occurs on some applications I've seen referenced within the github issues posted here including some Unity one, and I've verified android:debuggable is indeed set on both not just my own application.

Environment

baldurk commented 6 months ago

Most Android bugs are caused by broken devices, not any problem in RenderDoc. OnePlus devices have been known to cause problems in the past. Do you have a different device you can try from a different manufacturer?

If not, can you check in the device settings to see if there is some kind of additional manufacturer-specific setting that needs to be enabled for debugging? From what you describe the Android debug functionality is not properly enabled, likely by some device-specific interference.

pnill commented 6 months ago

Unfortunately I usually do development in an emulator or on this phone, don't have another device handy but considering buying a cheap used pixel for this purpose due to the fact AGI is reported to work with it.

I've checked device settings and to my surprise, there was "Enable GPU debug layers" option with a description of "Allow loading GPU debug layers for debug apps". Between this and playing around with other settings it seems to be working now I was able to capture some frames. (When I was originally writing this, It was to say it didn't work after some persistence and further tweaking it somehow worked by a miracle so I'm happy now).

Additional notes as that didn't seem to work right away, I also changed the default graphics setting to use the system driver, disabled the "gaming" app from hooking while a game is running, and changed how background apps are handled as I suspected the render doc server was getting terminated in the background.

One or all of those things appears to have solved my issue and you were correct, it's device related. Thank you for pointing me in the right direction to troubleshoot further.