Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
923 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...