Can't attach Android Studio's debugger to Android process

后端 未结 12 1146
被撕碎了的回忆
被撕碎了的回忆 2020-12-29 18:12

I can\'t attach Android Studio\'s debugger to my debuggable application process. Anyone else had this issue? Basically I can\'t get my app listed in Choose Process

相关标签:
12条回答
  • 2020-12-29 18:55

    In my case I just plug out and plug in cable from phone. Process was listed, and i was able to attach debugger

    0 讨论(0)
  • I solved this by going to a terminal and doing:

    • adb kill-server
    • adb start-server

    Then I clicked in the "attach debugger" button and I could use it as normal

    0 讨论(0)
  • It could be because the release build variant (which you can set in the Build-Variants section) has been chosen mistakenly, only debug-variant is debuggable.

    Hope this can be helpful to some friends.

    0 讨论(0)
  • 2020-12-29 19:01

    same did happen with me, the root cause for this problem was interruption(network disconnection or force close) while updating any of the plugin(in my case kotlin) Solution For mac: goto prefrences(shortkey: cmd + ,)

    For windows:(short key: **ctrl + alt + s) or through menu

    then in left panel look for Languages and Frameworks -> kotlin/java updaes and upon selecting it. In right pan there will be option(button) to update the plugin. update the plugin.

    Exit and Restart the android studio. now you will be able to debug with all list of available processes running.

    0 讨论(0)
  • 2020-12-29 19:12

    So finally I got it working, by:

    Checking 'Show all processes' checkbox!
    

    BUT as you see in the question, checkbox was on at the beginning, so there were multiple issues.

    To summarize, these are other actions to be done:

    • Kill all adb processes (use ps -x | grep adb and kill -9 [process id])
    • adb start-server in terminal
    • Reconnect device
    • adb devices (to make sure device is connected successfully)
    • Make sure Android DDMS Devices | logcat shows your app and only one device is listed.
    • Check Show all processes checkbox. See screenshot
    0 讨论(0)
  • 2020-12-29 19:12

    I just encountered this one as well. I was pulling my hair out and did everything that was posted here. I thought I could add to the solutions here in case everyone had tried everything. I solve it via making my build variant debuggable.

    So I made a PR and it was merged, unfortunately my debuggable flag on my own build variant was turned off when I pulled the source back, so I just have to turn it back on:

    on your build.gradle file:

    android {
       ...
       buildTypes {
          ...
          my_build_type {
                minifyEnabled false
                shrinkResources false
                debuggable true    // was false before  
          }
       }
    }
    

    Also make sure that this build variant was set before you build your app to the device:

    0 讨论(0)
提交回复
热议问题