TGD on a rooted device (shell id = 0) crashes the process when trying to inject debugger

Hi!
I’ve been using TGD with debuggable apps for a while, but I also want to profile non-debuggable builds. As I’ve searched this forum, it turned out that TGD checks for the “rooted” device by checking “adb root, adb shell id” so I have spent quite some time on making it work (and it finally does).
However, TGD still can’t launch the process as it fails at start (apps just crash)

Starting ADB server, please wait...
Scanning for devices...
Device Product Model: SHIELD Tablet
Detected current device is running Android N
Located 32-bit driver libraries in /vendor/lib/egl/
Waiting for the device to become available
Checking If adbd has root permission
Waiting for the device to become available.
Rooted device
Setting SELinux policy to permissive.
SELinux policy successfully changed to permissive.
Querying instrumentation property.
Checking debugger status...
Host supports 32-bit graphics debugging
Graphics debugger is enabled.
Scan for devices complete.
ABI: armeabi-v7a
Unsetting property wrap.com.myAwesomeAppBundleIdHere
Launching com.myAwesomeAppBundleIdHere/LaunchActivity
Scanning process...
Injecting debugger...
Debugger injection failed
Can't find process

As you can see, it sees the device as rooted, tries to launch some app, but it crashes instantly and TGD can’t find the process anymore (I have replaced bundle id and activity name)

Hi cyrilltoboe,

Is your device rooted? If not, even TGD sees the device as rooted, it will not be able to debug non-debuggable app.

Oooh I see now.
Yes, it’s rooted and I have spent quite some time to root it and to also appear as rooted to TGD (with that adb root thingy)
I have misunderstood your previous answer:

I thought that it meant that in order to profile a non-debuggable app the device must be rooted.

codym_nv can you please specify why would we possibly need to root our Shield Tablets for?

Hi,
It’s mainly for permission reason.
On a non-root device, we cannot debug a non-debuggable apk, because android system security doesn’t allow it. To debug an app, we will launch it with -D argument, but on non-debuggable apk and on non-rooted device, it’s not allowed by the system.

Thanks for your time answering these questions!

I confirm that the device is rooted and I can launch any APK with -D argument via ADB, and apps launch saying that they are waiting for the debugger.

If I do the same thing via TGD, it launches with the same message, but instantly crashes (most likely due to some internal debugging stuff) so TGD says that it can’t find the process anymore (because it has just crashed)
If I launch it with -D manually and then go to the “Attach” menu of TGD, it says that it can’t find any suitable process to attach to.

So the setup is:

  1. Rooted device
  2. TGD sees it as rooted
  3. I can launch any app with -D argument (it launches and waits for the debugger)
  4. When I “Launch” my target app via TGD, it launches with -D but instantly crashes

Here are some adb log messages right after crash:

WindowManager: Failed looking up window
WindowManager: java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W@dc9cda9 does not exist
WindowManager:         at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9165)
WindowManager:         at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9156)
WindowManager:         at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2315)
WindowManager:         at com.android.server.wm.Session.remove(Session.java:203)
WindowManager:         at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3442)
WindowManager:         at android.view.ViewRootImpl.doDie(ViewRootImpl.java:6072)
WindowManager:         at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3781)
WindowManager:         at android.os.Handler.dispatchMessage(Handler.java:102)
WindowManager:         at android.os.Looper.loop(Looper.java:154)
WindowManager:         at android.os.HandlerThread.run(HandlerThread.java:61)
WindowManager:         at com.android.server.ServiceThread.run(ServiceThread.java:46)

Hi cyrilltoboe,

Could you please share more information?

  • Android OS version, build
  • TGD version
  • How did you root the OS?

Could you also share us the app? or any other app with the same issue.
Thanks.

  • Android 7.0, build NRD90M.1928188_1006.1489, Shield software version - 5.3 (24.29.404.182)
  • TGD version - 2.6.23382753
  • nvidiashieldzone method (the one for original Shield Tablet, not Shield K1 as I have the original tablet)

test apk (really bare minimum setup, but reproduces this issue) - https://drive.google.com/file/d/1aufqcyt5MZLYQ5-cdJVQTYX3BZ2o6zQk/view?usp=sharing

Thank you

I have the same issue. BTW, nsight for vs also can not debug, it crashes. But we can deploy and install the app, and see android logs via adb

It is working on other phones. it is only not working on my Huawei mate 10 pro running Android 8.

Thanks for the info. But only userdebug OS image is officially supported. Other methods of rooting device is not guaranteed to work with TGD.

Hi lixizhi,

Could you please provide more information?

  • TGD version
  • how did you root the device?
  • what are the detailed steps to reproduce the crash?
    Thanks