23

I have difficulties with with debugging at Android Studio. After trying to launch application in debug mode device show alert with "Waiting For Debugger" title that never disappear. Also I have android:debuggable="true" in my manifest file and seems like device connected correctly, because I can simply run my application without any problem. What I'm doing wrong?

user1248568
  • 621
  • 1
  • 9
  • 29

9 Answers9

36

Remove android:debuggable="true", because when you run/debug an application in Android Studio is signed with a debug certificate so that setting is not mandatory.

Then check from console if the device is correctly attached with an adb devices. You should see it listed.

Then try in this way:

1 - close Android Studio and any other IDE you have opened (maybe you have Eclipse also running?) and emulator instances;

2 - remove USB cable from PC;

3 - run adb kill-server from console;

4 - open Android Studio;

5 - click on run/debug;

6 - when the window to select the device appears, attach your device to USB and USB to your computer;

fasteque
  • 4,309
  • 8
  • 38
  • 50
  • 2
    @cheeesus in that case, try step 3 as first thing. Kill the server, then wait few seconds, then re-issue the `adb devices` command. Server will be restarted and you should see your devices listed. – fasteque Aug 22 '14 at 11:36
  • Thank you!!! I had no idea why adb was hanging when I launched Android Studio but unplugging the device before launch worked perfectly. – Jedidja Oct 09 '14 at 13:18
  • Great! Works for me. Just need to say it's a bit annoying as I need to repeat it several times a day... can't the guys from JetBrains fix the tool? – pepan Mar 20 '15 at 11:07
  • 2
    @AlexanderSolonik in your shell or terminal. If you have the Android Platform Tools in your path, you can run it from any location, otherwise `adb` is stored int `YOUR_ANDROID_SDK_FOLDER/platform-tools`. – fasteque Jul 15 '15 at 07:52
  • @fasteque , thanks one more question where do i change from MTP to PTP ? any idea ? – Alexander Solonik Jul 15 '15 at 09:26
  • @AlexanderSolonik it depends on your android version but it should be more or less the same. On my device (Android M Preview 2), if I pull down the notifications, I see "USB for charging": clicking on it I get a popup dialog to select MTP, PTP, MIDI, ... – fasteque Jul 15 '15 at 09:29
  • @NoniA. if you have the Android SDK correctly installed, that means you have to add adb and the other tools to your `PATH` variable. I don't know your environment (OSX, Windows, ...) but you can easily search for the answer in this site. Examples: http://stackoverflow.com/q/20564514/2396432, http://stackoverflow.com/q/8744758/2396432 or http://stackoverflow.com/q/17901692/2396432 – fasteque May 14 '16 at 05:51
6

also try restarting the device - that worked for me when I had the same issue

Nick Wood
  • 680
  • 6
  • 10
3

I have similar issue (running Android Studio on Ubuntu)

What I do:

  • Close Android Studio (and Emulator(s) if running)
  • Go to adb folder (/wherever_location_is/sdk/platform-tools) and run command:

    ./adb kill-server

  • Open Android Studio.

Now Logcat messages appear again.

Andrew
  • 36,676
  • 11
  • 141
  • 113
2

Remove those lines related to debugging. When you launch an application from Android Studio it is signed with a debug key. Any debugging information you need can be viewed in logcat from Android Studio. Also make sure you are running the latest version (help -> check for updates) I think that's where its at.

Max McKinney
  • 1,218
  • 15
  • 25
2

I'm struggling with similar issue every day and as restarting the studio or the device is pretty time consuming (and sometimes even does not work), I was trying many things and by coincidence I found an awkward (but working) solution.

When you are in the situation when you hit debug button in Android Studio, the studio says it's connected and the device says: Waiting for Debugger, but the device waits forever, do this:

  • In Android Studio, hit the 'Edit Configurations' pop-up button
  • Once the Run/Debug Configurations dialog opens, the debug process starts!

Works like a miracle!

pepan
  • 678
  • 6
  • 11
1

Try this way - it works for me:

open
Run 
run/debug configuration 
Android app 
app  
Debugger 
Debug type 
set Auto

enter image description here

John Veldboom
  • 2,049
  • 26
  • 29
Ayman
  • 183
  • 1
  • 3
  • 14
0

I had the same problem when i enabled the Proguard for debug!, Please disable it and try !!!

Muhamed Riyas M
  • 5,055
  • 3
  • 30
  • 31
0

I think this might help. After launching application, click on Run and find Attach Debugger to Android Process [You may find this helpful[1]

Merhawi Fissehaye
  • 2,482
  • 2
  • 25
  • 39
0

Check in gradle. if you apply proguard for debug then dubugging process not applicable to app.Make sure minifyEnabled false in debug.

Manju
  • 41
  • 5