Not Able To Debug App In Android Studio
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.
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"
In Android Studio, go to BUILD -> Select Build Variant
Now try debugging. Thanks
Andy Roy D.
Updated on July 08, 2022Comments
-
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:
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 almost 11 yearsDid you find a solution?
-
Ahmad Behzadi over 7 yearsUninstalling app from device and run it again from Android studio solved my problem
-
castle bai over 7 yearsI 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 almost 6 yearshave a look at my answer here. that might solve the problem
-
-
Ari R. Fikri almost 11 yearsCan we step one line at a time, just like in eclipse ? if can, how to do that ?
-
free3dom almost 11 yearsSure 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 underMain menu
->Run
. See this for more info. -
Soundararajan over 9 yearsThe 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 over 9 yearsThanks @Soundararajan for bringing that to my attention. I will update the answer to reflect that.
-
Rui Santos almost 9 yearsThis is what helped me. Suddenly the debug stopped working, after this worked again.
-
Mathijs Segers almost 9 yearsStil working as of today, tried restarting and everything.
-
Admin over 8 yearsNot work 2015, build.gradle put buildTypes { debug { debuggable true
-
Rachael over 8 yearsI just needed to close and reopen android studio for that project instance to make the bug work :/
-
Daniel Wood over 8 years@delive Is right. I couldn't use my breakpoints until I added that to my build.gradle.
-
Harmen over 8 yearsYesterday, while nothing else helped, a reboot did the trick.
-
Mahendra Chhimwal almost 8 yearsThis work for me. Even adb kill-server and adb start-server commands did not,but it does
-
Jules about 7 yearshorrible workaround but the only thing working for me right now, THANKS!!!
-
clever_trevor almost 7 yearsNote for the last part: Shift + F9 is the shortcut to run Debug on Windows. On Mac, it is Control + D.
-
Jason Bowers over 6 yearsWorked for me even though I did not have a custom "android:process" in my Manifest file.
-
visc over 6 yearsThis 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 over 6 yearsthanks and had to make minifyEnabled false and shrinkResources false
-
NoWar over 6 yearsIn which console we have to start it?
-
jonathan3087 about 6 yearsDisable and re- Enable ADB Integration helped me on Android Studio 3.0.1
-
VictorB almost 6 yearsJust 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 almost 6 yearsBtw, this solution worked for me without closing AS, or the terminal session.
-
James Watkins almost 6 yearsThere is no such menu item called "Tools==>android" in Android Studio version 3.1.3 and I cannot find this option anywhere
-
gmartinsnull over 5 yearsthis was the solution for me. Thanks
-
Kevin Amiranoff over 5 yearsIn android 3.X I posted an answer that worked for me
-
Haider Ali almost 5 yearsRun this command in the android studio terminal or navigate to your project from external terminal
-
nibbana almost 5 yearsUsing the debug app button as suggested solved the problem.
-
Andy Romero almost 5 yearsit is work for my. I put the in the manifest <application android:debuggable="true"> </application> and debug perfect. Thanks
-
Pete Alvin over 4 yearsThe Build menu doesn't have a "Select Build Variant" option.
-
Pete Alvin over 4 yearsThat debug button is disabled/greyed. How do you get it to be clickable?
-
spartygw almost 4 yearsNo "adb" options anywhere in the menus for Android Studio 4
-
Buckstabue over 3 yearsI faced with this issue in android studio 4.1 and your solution helped me. Thanks
-
Pratheesh over 3 yearsUse 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 over 2 yearsAvoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one
-
Acauã Pitta about 2 yearsdon't work. what works was restart adb server: stackoverflow.com/a/60805797/4628993