shmemBase_attach failed when connecting to Android device

前端 未结 2 870
孤独总比滥情好
孤独总比滥情好 2021-01-16 17:50

I\'m trying to hook up jdb on my computer to a process (any process really) on my Android device, but it doesn\'t work at all.

So the commands I used are straight of

2条回答
  •  渐次进展
    2021-01-16 18:16

    Try quitting Android Studio.

    Its ADB is running even when your project is not. Here is an example where I quit Android Studio, ran ADB, launched my app within the device, then ran ADB again to see the new process id, forwarded the port and finally attached JDB:

    $ adb -d jdwp
    * daemon not running. starting it now at tcp:5037 *
    * daemon started successfully *
    28462
    ^C
    $ adb -d jdwp
    28462
    1939
    ^C
    $ adb -d forward tcp:7777 jdwp:1939
    $ jdb -attach localhost:7777 -sourcepath ./src
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    Initializing jdb ...
    > 
    

    You can also turn ADB on and off within Android Studio:

    Android Studio->Tools->Android->Enable ADB Integration

    When ADB integration is disabled, you can run ADB from the console as usual. You can also control and background ADB daemons with:

    adb kill-server
    adb start-server
    

    I wasted a couple of hours on this, so it really needs better documentation. Also I would like to know how to run both the Android Studio debugger and JDB at the same time so that I can profile all method calls while stepping through the debugger (because the built-in Android Studio monitor tracing doesn't show consecutive method calls with arguments):

    http://mybrainoncode.com/blog/2013/11/03/debugging-android-with-jdb/

    https://teaspoon-consulting.com/articles/tracing-java-method-calls.html

提交回复
热议问题