Not Able To Debug App In Android Studio

180,093

Solution 1

There is a Debug icon on the toolbar. It looks like a little "bug" and is located right next to the Run icon (which looks like a play button). Try launching the application with that.

Click here to debug

Edit: The following is deprecated when using Android Studio with Gradle.

There is also a debug flag in the AndroidManifest.xml file. It is located under the application tag, and should be set to "true", as follows:

<application android:debuggable="true">
</application>

Solution 2

I solved this issue after doing the following steps:

Go to Tools==>android==>Disable ADB integration and enable it again.

After that, unplug USB from device and plug in again.

Finally press shift + F9

Solution 3

Another thing to be careful of (I did this so I know, duh). Be sure not to enable Proguard for debug!

Solution 4

I also randomly had this problem even after debugging many times in Android Studio. One day the debugger just wouldn't attach. I just had to quit Android Studio and reopen it and the debugger started working again.

Solution 5

    <application android:debuggable="true">
</application>

This no longer works! No need to use debuggable="true" in manifest.

Instead, you should set the Build Variants to "debug"

Debug Mode

In Android Studio, go to BUILD -> Select Build Variant

Now try debugging. Thanks

Share:
180,093
Andy Roy D.
Author by

Andy Roy D.

Updated on July 08, 2022

Comments

  • Andy Roy D.
    Andy Roy D. almost 2 years

    I am making an app in Android Studio, now trying to debug it through adb. When I click on the word Android and the logo on the bottom bar, logcat comes up and recognizes my device. Then I see this:

    screenshot

    What do I need to do to my app to make it "debuggable"?

    FYI was developing this app in Eclipse before and adb worked fine.

    • Paul
      Paul almost 11 years
      Did you find a solution?
    • Ahmad Behzadi
      Ahmad Behzadi over 7 years
      Uninstalling app from device and run it again from Android studio solved my problem
    • castle bai
      castle bai over 7 years
      I had a problem today, breakpoints cannot stop the program. And It was because of setting in build.gradle. I set debug build type with minifyEnabled is true, remove this and breakpoint worked.
    • Muahmmad Tayyib
      Muahmmad Tayyib almost 6 years
      have a look at my answer here. that might solve the problem
  • Ari R. Fikri
    Ari R. Fikri almost 11 years
    Can we step one line at a time, just like in eclipse ? if can, how to do that ?
  • free3dom
    free3dom almost 11 years
    Sure you can. Once you hit a breakpoint the debug window is displayed, the toolbar at the top contains the various step commands. You can also configure the various debug keyboard shortcuts from File -> Settings -> Keymap - they are located under Main menu -> Run. See this for more info.
  • Soundararajan
    Soundararajan over 9 years
    The latest version of android studio doesn't mandate you to set the android:debuggable, infact it shows an squiggle which suggests to set it in the configuration rather than in the manifest. This helps in avoiding accidently publishing an app with debug information.
  • free3dom
    free3dom over 9 years
    Thanks @Soundararajan for bringing that to my attention. I will update the answer to reflect that.
  • Rui Santos
    Rui Santos almost 9 years
    This is what helped me. Suddenly the debug stopped working, after this worked again.
  • Mathijs Segers
    Mathijs Segers almost 9 years
    Stil working as of today, tried restarting and everything.
  • Admin
    Admin over 8 years
    Not work 2015, build.gradle put buildTypes { debug { debuggable true
  • Rachael
    Rachael over 8 years
    I just needed to close and reopen android studio for that project instance to make the bug work :/
  • Daniel Wood
    Daniel Wood over 8 years
    @delive Is right. I couldn't use my breakpoints until I added that to my build.gradle.
  • Harmen
    Harmen over 8 years
    Yesterday, while nothing else helped, a reboot did the trick.
  • Mahendra Chhimwal
    Mahendra Chhimwal almost 8 years
    This work for me. Even adb kill-server and adb start-server commands did not,but it does
  • Jules
    Jules about 7 years
    horrible workaround but the only thing working for me right now, THANKS!!!
  • clever_trevor
    clever_trevor almost 7 years
    Note for the last part: Shift + F9 is the shortcut to run Debug on Windows. On Mac, it is Control + D.
  • Jason Bowers
    Jason Bowers over 6 years
    Worked for me even though I did not have a custom "android:process" in my Manifest file.
  • visc
    visc over 6 years
    This has tripped me up a number of times, even in other IDEs. I believe the ability to debug release is configurable in most IDEs and sometimes advised if you want to attach the debugger to released apps.
  • Janardhan R
    Janardhan R over 6 years
    thanks and had to make minifyEnabled false and shrinkResources false
  • NoWar
    NoWar over 6 years
    In which console we have to start it?
  • jonathan3087
    jonathan3087 about 6 years
    Disable and re- Enable ADB Integration helped me on Android Studio 3.0.1
  • VictorB
    VictorB almost 6 years
    Just what I was looking for. Previously, I could get this done with a simple adb reconnect command, but it doesn't do this anymore in AS 3.1 (maybe I'm doing something wrong, or not enough?
  • VictorB
    VictorB almost 6 years
    Btw, this solution worked for me without closing AS, or the terminal session.
  • James Watkins
    James Watkins almost 6 years
    There is no such menu item called "Tools==>android" in Android Studio version 3.1.3 and I cannot find this option anywhere
  • gmartinsnull
    gmartinsnull over 5 years
    this was the solution for me. Thanks
  • Kevin Amiranoff
    Kevin Amiranoff over 5 years
    In android 3.X I posted an answer that worked for me
  • Haider Ali
    Haider Ali almost 5 years
    Run this command in the android studio terminal or navigate to your project from external terminal
  • nibbana
    nibbana almost 5 years
    Using the debug app button as suggested solved the problem.
  • Andy Romero
    Andy Romero almost 5 years
    it is work for my. I put the in the manifest <application android:debuggable="true"> </application> and debug perfect. Thanks
  • Pete Alvin
    Pete Alvin over 4 years
    The Build menu doesn't have a "Select Build Variant" option.
  • Pete Alvin
    Pete Alvin over 4 years
    That debug button is disabled/greyed. How do you get it to be clickable?
  • spartygw
    spartygw almost 4 years
    No "adb" options anywhere in the menus for Android Studio 4
  • Buckstabue
    Buckstabue over 3 years
    I faced with this issue in android studio 4.1 and your solution helped me. Thanks
  • Pratheesh
    Pratheesh over 3 years
    Use this option to restart ADB in Android Studio 4: Tools -> "Troubleshoot Device Connection" Here tap "Next" button. Finally ADB restart option is there in the 4th step
  • dicarlomagnus
    dicarlomagnus over 2 years
    Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one
  • Acauã Pitta
    Acauã Pitta about 2 years
    don't work. what works was restart adb server: stackoverflow.com/a/60805797/4628993