Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: the debugger detaches but the app stops too

I've been looking for some information about an issue related with the debugger on Android Studio (I'm using 2.2.3 version) and I have found this two links:

How to stop debug without closing app in Android Studio 2

unanble to detach debugger from Android Studio 2.2.3

They say that, in order to detach debugger and keep on running the app, you should click on "Close" button instead of "Stop" button, but this doesn't work for me. When I click "Close" button I get a dialog like this:

Android Debugger is running

I keep unchecked the "Terminate the process after disconnect" option, but when I click on "Disconnect" the debugger detaches, which is correct, but the application stops too, which I guess it's not the expected result.

Any idea? Is this a bug in the latest version of Android Studio? Perhaps that functionality does not longer exist or maybe it is now attached to another button?

Thanks in advance.

David.

like image 665
David Burgos Prieto Avatar asked Feb 24 '17 11:02

David Burgos Prieto


People also ask

Why is my debugger not working in Android Studio?

Debugger Isn't Working: Disconnected or Client not ready yetThis is usually a signal that the emulator instance is not properly connected with ADB and Android Studio. There are a few steps to try: First, try uninstalling the app from within the emulator and then restarting the emulator completely.

How can you debug your app when it's already released?

You can start a debugging session as follows: Set some breakpoints in the app code. In the toolbar, select a device to debug your app on from the target device drop-down menu. If you don't have any devices configured, then you need to either connect a device via USB or create an AVD to use the Android Emulator.

How do I terminate debugging?

Click Stop Debugging on the Debug menu to stop the target's execution and end the target process and all its threads. This action enables you to start to debug a different target application. )

Is waiting for the debugger to attach Android studio?

If it is stuck waiting for a debugger means it is not attached to the app. You have to manually attach by clicking on Attach Debugger to Android process. It is on the right side of the run icon.


1 Answers

I have just updated to 2.3 version of Android Studio and I think this issue is solved now:

  1. If you run the app in debug mode, red square button will detach the debugger and will stop the app too. So don't run your app in debug mode, but in normal mode (Run app).
  2. Then go to Run > Attach debugger to Android process, select the application on the list and click OK.
  3. Now, if you move the mouse over the red square button you'll get the message "Stop Android Debugger". Click on it and the debugger will detach but the app won't stop, which is the expected result :)

I don't really know if this worked lin the previous version too, but anyway this is how the debugger can be detached without stopping the app.

Bye!

like image 139
David Burgos Prieto Avatar answered Oct 20 '22 20:10

David Burgos Prieto