Attach Android debugger to process built with Eclipse project I don't own

android, debugging

Solution

Answering my own question -- I created a debug configuration of type Remote Java Application, and specified the port displayed in the DDMS window. I assume I could use any JDWP compliant debugger to do this.

Problem

I would like to debug a portion of an Android application for which I do not have the original Eclipse project that was used to build it. I have built a `.jar` file that implements an Android Activity. I use Eclipse to develop and debug it, and `javac/jar` to build the `.jar` with the appropriate classes. The `.jar` is shipped off to a client, who then builds it into their application. Now they would like me to debug something, and have provided me a .apk for their application that calls `android.os.Debug.waitForDebugger()`. I do not have their source code or project. I install and run the application, and when it hits that call, I see the process in the Eclipse DDMS tab waiting on attachment (it has the red bug icon). When I try to attach to the process in Eclipse, by clicking the "Debug the selected process" button, I get this error message: No opened project found for <their-app-package-name>. Debug session failed! Is there a way for me to attach to this process, without the original application project? If not, I will resort to `android.util.Log` statements, but I would rather not, for obvious reasons. As I wrote above, I have my own project with all the source code used to build the `.jar` that was incorporated into this application. I have tried changing the package name in my test project manifest, but that does not appear to change anything as far as Eclipse is concerned. Thanks for any help!

Original source