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
:
And then, here's how Process selection
dialog from Android Studio looks like:
Any ideas why my app is not shown in the Choose Process
list?
Although, DDMS
sees my app in Devices | logcat
list:
Android Monitor
also sees the app in Devices
list:
I've tried these actions:
- Restarting
MacBook
- Restarting devices: tried with
Samsung Galaxy Note II N7100
(4.3) andSamsung Galaxy S4
(4.4.2) - Reenabling
Settings->Developer Options
on the devices - Reenabling
Settings->Developer Options->USB debugging
on the devices - Restarting
adb
by runningadb kill-server
andadb 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 runningadb tcpip 5555
and then connecting to it withadb connect 192.168.1.87
Waiting more
&Restart
when got this error sayingADB 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.
So finally I got it working, by:
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:
adb
processes (useps -x | grep adb
andkill -9 [process id]
)adb start-server
in terminaladb devices
(to make sure device is connected successfully)Android DDMS
Devices | logcat
shows your app and only one device is listed.Show all processes
checkbox. See screenshotI 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
It could be because the
release
build variant (which you can set in theBuild-Variants
section) has been chosen mistakenly, onlydebug-variant
isdebuggable
.Hope this can be helpful to some friends.
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.
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 !
In my case I just plug out and plug in cable from phone. Process was listed, and i was able to attach debugger