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

只谈情不闲聊 提交于 2019-11-30 06:04:13
ViliusK

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
Manohar

I solved this way

a. Closed Android Studio
b. Did adb kill-server from a terminal. Also check the adb process in also killed from the Running processes window in PC
c. Started Android Studio
d. Android Studio tried to initialize adb again and back to work.

This is what worked for me and its simple, go to Tools->Android->Enable ADB Integration, click on this and mark it selected if not selected this will allow your genymotion instance to connect to ADB but if this doesnt work then, if above mentioned setting is selected then mark unselected and wait till ADB is refreshed( few seconds) then again go to same setting and click on it to mark is selected, this will restart ADB and connect it. This works perfect for me each time i see this issue.

user3201520

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.

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

You do not have to close android studio as I have seen many advise, you can use the terminal from here. In this way : 1 Go to the terminal in Android studio; 2 Did adb kill-server to kill the process; 3 Did adb start-server to running here 4. Check if the devices is attached with adb devices

Now it should work !

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.

In addition to all answers before, If you add breakpoints that evaluate and log, may be one of them cause Null Pointer exception. So go to run -> viewBreakpoints... -> unselect all of them.

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

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:

  1. Close the Android Studio.
  2. Kill the adb from terminal 'adb kill-server'. Open android studio ,then attach the debugger. You will be able to see your project.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!