1

Android 的 DVM 在 JDWP 协议之上使用 DDM 协议。在文档和示例中,需要 ADB 作为桥(实际上 ADB 是 Android 调试桥)。

我的问题是:是否可以使用所有 DDM 或 JDWP 协议开发 APK 以跟踪真实设备中的应用程序?或者有什么保护措施?

4

1 回答 1

2

Android apps are configured to talk to the ADB daemon for JDWP connections. DDMS queries the ADB daemon to get the list of debuggable processes. (Type adb jdwp to see the list yourself.)

If Dalvik were configured to listen to a TCP socket, you could use adb forward to set up port-forwarding and just connect your debugger to it directly through TCP. Development was done this way in the very early days, before DDMS existed.

(To this very day, around line 4185 in ActivityThread, you can see it announce that it's waiting on port 8100. History buffs may also find the "Connection Establishment" section in the DDMS design doc interesting. Not sure why that doc is all in italics.)

As it stands, the Dalvik VM is only listening for connections through ADB, so you can't attach a JDWP-based debugger to an app any other way.

于 2014-04-11T00:20:35.710 回答