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

65,667

Solution 1

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

Solution 2

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.

Solution 3

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.

Solution 4

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

Solution 5

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.

Share:
65,667

Related videos on Youtube

ViliusK
Author by

ViliusK

Android developer, Playgong co-founder. SOreadytohelp

Updated on April 07, 2021

Comments

  • ViliusK
    ViliusK about 3 years

    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 dialog.

    I'm selecting Attach debugger to Android process:

    Attach debugger to Android process

    And then, here's how Process selection dialog from Android Studio looks like:

    No app is in the list to be debugged

    Any ideas why my app is not shown in the Choose Process list?

    Although, DDMS sees my app in Devices | logcat list:

    <code>Devices | logcat</code> list

    Android Monitor also sees the app in Devices list:

    Android Monitor | Devices list

    I've tried these actions:

    • Restarting MacBook
    • Restarting devices: tried with Samsung Galaxy Note II N7100 (4.3) and Samsung Galaxy S4 (4.4.2)
    • Reenabling Settings->Developer Options on the devices
    • Reenabling Settings->Developer Options->USB debugging on the devices
    • Restarting adb by running adb kill-server and adb start-server
    • Reconnecting device from macbook and/or plugging to another USB port
    • Launching Genymotion virtual device on macbook
    • restarting in TCP mode port: 5555 by running adb tcpip 5555 and then connecting to it with adb connect 192.168.1.87
    • Waiting more&Restart when got this error saying ADB not responding. You can wait more, or kill "adb" process manually and click 'Restart' Errors in ADB: ddms: '$ANDROID_HOME/platform-tools/adb,start-server' failed -- run manually if necessary Error screenshot

    Update:

    What I've noticed is that device appears multiple times in the Android DDMS->Devices | logcat list. If I choose 1st device from the list, it shows, there's No debuggable applications, but I select last device (4th in the screenshot) I see my debuggable application. See screenshots: 1st and 4th. Although, even there's only 1 device in the list and showing debuggable device and application, process still does not appear in the Choose Process dialog.

  • Marty Miller
    Marty Miller over 9 years
    Sorry but this is not the solution. As you mentioned, the box was checked at the beginning. If your process isn't in the list when the box is unchecked, it's not the process of the running app.
  • netcyrax
    netcyrax over 9 years
    Make sure that Eclipse and ADT are not open when you are trying to debug with Android Studio.
  • Jackpile
    Jackpile almost 9 years
    I had to close and restart Android Studio (Mac) and then check "Show all processes" to get the process to appear.
  • Egemen Hamutçu
    Egemen Hamutçu over 8 years
    I am tired and older than ever closing and reopening things to fix them up all over again. Thanks.
  • Michael Osofsky
    Michael Osofsky over 5 years
    This was indeed the cause of my problem when trying to run on an emulator. I had to discover it from having another problem trying to run debug on a physical device, see stackoverflow.com/a/33219069/2848676
  • Mahdi Moqadasi
    Mahdi Moqadasi over 5 years
    Thanks, you saved my time ;)
  • Not Mandatory
    Not Mandatory about 5 years
    This worked for me on OSX (Mojave) with IntelliJ (2018.3) when adb could see my phone but IDE would not show it on the list to connect to for debugging. 1) make sure your project has the android facet, 2) shutdown intellij, 3) adb kill-server, 3) restart intellij.. this will allow intellij to start the adb server which seems to do the trick for me.
  • Pedro Romão
    Pedro Romão about 5 years
    killing adb by terminal worked for me. Thanks a lot
  • vianna77
    vianna77 over 2 years
    I had the same problem, but I'm using Windows. I just restarted the Android Studio and it solved the problem.