Is it possible in Android Studio to debug an already running application without restarting it (assuming the application was previously installed through Android Studio)?
Follow this step (I assume that you have connected device and USB debugging option is turned on):
Step 1 : Click on Attach Debugger option.
Step 2 : Now dialog is open, select the process you want to run.
There is a button1 besides run and debug ones to add debug to your running app. You have to run the debug build to be able to do this.
Yes you can. Just click on the button highlighted in the given image
After clicking this image select the process, running on any attached device, which you want to debug.
Related
Simple question, but is it possible to view the entire logcat output of an Android device in Android Studio? Meaning all of the logs from everything that's happening on the device, not necessarily only those generated by the app in development.
I ask because I have a bug that does not show up on the debug build (i.e. I build it in Android studio and run it on a device), but it DOES show up in the production build for the same code, and I would love to see what is happening on the device.
Essentially, I'm asking if it's possible to select nothing from the following dropdown menu.
Use no filters option in your Android studio Logcat.
How you can select nothing in processes spinner:
Stop your application
Close the emulator
Press launch in android studio
Cancel launching the application
Emulator is still launching
You have no debuggable processes in your spinner.
How can I debug an app that was built with debugging turned on but is already installed on a phone?
I have tried to find a way to attach Android Studio to an existing app, but can't figure that out. Do I need to use adb in some way to do this? Any hints would be appreciated.
Click in the fourth button in the bar (This is screenshot is from AndroidStudio 2.2, the icons have changed but the position is the same).
After that, it will prompt to you all running application that can have debug attached, just select it and you are now debugging.
I,m working in eclipse to develop an android app and when i tried to debugged on my samsung tab, i got the following msg on its screen "Waiting for debugger" and beneath it was written "application xxx is waiting for the debugger to attach ", I did some search and found to:
See target sdk
Restart eclipse and device
Update eclipse
Uninstall app from device and install again
I tried all this, but nothing helped. Kindly help me.
In my Nexus 7 Tablet running android 4.4.2
I solved this problem by going into
Settings
Developer options
Select Debug app
was selected , Select Nothing
Done!
Sometimes "force to close and open again" doesn´t work, so this problem could be present when the application is currently in debug and is selected to be debugged, then from your device go to:
Settings ->
Developer options ->
Select app to be debugged ->
Select Nothing
or when the application is supossed to being in "debug mode" but is not selected as be debugged :
Settings ->
Developer options ->
Select app to be debugged ->
Select the application!
I had same issue. Adding permission didn't help me, because Eclipse automatically enables debugging when it runs in debug mode.
Check your device setting whether "Wait for debugger" is unchecked under "Developer Options".
Also I tried closing and restarting Eclipse, and finally it worked!
I'm still figuring out what the real problem is, but hope this helps!
Restarting Eclipse is the only solution which works every time for me.
Go to Settings->Developer options.
And then just turn off and on check box right to the Developer options title.
Also toggle USB Debugging again.
Worked for me
I was having same problem with my emulator.
What i did is,
Close the emulator
Open AVD manager
Wipe Data from dropdown for the required emulator in AVD Manager. May be same thing work for devices also.
This has been asked before. It is uncommon, but some devices need an extra permission(flag) to let the debugger attach!
So open your androidManifest.xml and add this permission:
<uses-permission android:name="android.permission.SET_DEBUG_APP"></uses-permission>
Another reason for this dialog to hang there is when you have breakpoints in different processes of your components (application / activity etc...).
For example:
If you have a breakpoint in an activity that runs on a different process than your main application you will see this dialog until you attach the debugger to the process manually.
For android studio it will be using the icon in the middle:
The intuitive reason for this will be that when you run in a debug mode the debugger is attached to your main application process and not to all your other processes, thus you need to specify manually to which process you want to attach your debugger.
I had this problem when I press only F11 to Run.
Pressing F11 does debug. In order to run, press Ctrl+F11.
I haven't ever seen this problem after do like this.
I ran into this issue on Android Studio 2.0 with a Nexus 6 running 6.0.1.
I tried most of the suggestions above and finally fixed it by restarting both Android Studio and my Nexus 6.
I had this same issue and eventually found that in AndroidManifest.xml the Application element had the following attribute:
android:debuggable="false"
I changed this to
android:debuggable="true"
And the debugging then worked correctly.
I had the same problem with my Samsung S4 mini: after hibernating my pc with running eclipse, my phone couldn't connect with the debugger anymore. Restarting phone and eclipse didn't work.
I found, that my eclipse "disabled" the debugger in the android devices view: Window menu -> Show View -> Other -> Android -> Devices (also called DDMS view)
There was a red bug in front of my device. I enabled debugging by pushing the green bug button and now debugging works fine. This also works, if there is no bug in front of your debugging device.
It's also good to investigate port 8700 (the DDMS "base port", a port forwarder). When TCPView shows that this port is kept by process "", it's impossible to connect to ADB and debug. This process can't be killed nor terminated in TCPView. After logging out of Windows and logging in again, this port is free again. After starting AndroidStudio/IntelliJIdea this port is owned by process "idea64.exe" and its possible to debug.
When application crashes and AndroidStudio is restarted without stopping debugger (which also detaches from ADB), it may happen that port 8700 is not released, blocked by process "".
TCPView: https://technet.microsoft.com/en-us/library/bb897437.aspx
http://developer.android.com/tools/debugging/ddms.html
I got this error even when the USB was unplugged, and the app wouldn't start.
The only thing that worked for me was restarting the Android device.
I found this simple solution to it. Just click on the debug panel tab at the lower potion of your eclipse or wherever it is. Tada!! It works! It seems eclipse is getting old it needs a slight nudge. Works every time for me!
I got stuck with this when I tried to debug from IntelliJ cause I had both IntelliJ and Android Studio open.
Even if there where no debug-process going on in Android Studio, I was able to launch debug from IntelliJ after I closed Android Studio.
Restarted the Android Studio but that didn't help. Unplugged the device from USB and plugged it back in which did the trick for me, no changes needed in Developer options in the phone settings.
I have tried the following to no avail:
Restart the Android device.
Turn Developer options off/on under the Settings of the Android device.
Disable/enable USB debugging.
Restart Android Studio.
It started working after: Android Studio > File > Invalidate Caches/Restart...
For me it was when two different Android Studio were launched simultaneously
It's normal message when you debugging your application. Just wait for several seconds and app will start.
Simply force to close then, open it again :)
Edited:
force to close the application, and then go to menu and start the application by clicking on the apps icon
My problem:
I ran upon an awkward problem as I was developing my application. As mentioned in the title, every time I install my application (in run mode, not debug!) at start-up the waiting for debugger to connect.. message appears for 1-2-3 seconds, and the application starts.
What I want:
What I would like is to be able to start the application without that message appearing (it only started appearing in the last few days, and I can't remember changing anything related to debugging).
What I've tried:
I have tried setting the android:debuggable="false" but if I do this the debugger never attaches and the message never disappears.
I have also tried after installing to disable USB Debugging, but still no results.
Even if I kill the application and wake it up through an external source (it uses Google's C2D Messaging Framework) it still tries to run in debug mode on wake-up.
I have developed several Android applications and never stumbled upon this. Why wouldn't I be able to start the application in RUN mode? Is there any other way to install the application on the device, without hitting the run button in Eclipse?
I can post code-snippets from the AndroidManifest or from other parts of the code if necessary, but as I already mentioned I wasn't getting this kind of weird behavior several days ago.
Make sure your java files dont have any break point and Restart the device every thing should be normal.
I was experience the same problems where my application was always being run in debug mode. Restarting the device did the trick for me.
and make sure you are using
right click on project-->>Run As -->> Android Application
For me the solution was turning off the USB debugging from my device settings, and then turning it on again!
Much quicker than restart the whole device.
I had the same problem using Android Studio. Restarting my cellphone worked for me!
1. Open setting in ur phone.
2. Go to developer options.(About Phone-> Developer Option).
3. Disable the Developer option and again enable the Developer Option.
4. Enable USB debugging and Install via USB.
Run this command and the issue will be resolved
adb shell am clear-debug-app
Check if the option waiting for debugger is actived.
Settings -> Developer options -> Wait for debugger.
I think this it is new from Jelly Bean.
I'm assuming this is in the emulator and not on a device. If it is a device, ignore the rest. :p
It sounds like you saved a snapshot of the emulator as the debugger was connecting.
To fix:
1) Go to the AVD control panel, click on the emulator that's affected and hit start
2) when the window pops up, de-select "Launch from snapshot" and leave "Save to Snapshot" selected
3) Start the emulator.
4) Close the emulator
5) On the AVD control panel again start the emulator
6) Check "Launch from snapshot" again
That should fix things up.
EDIT.
Sorry for the wasted space, I read too fast and missed you talking about trying disabling USB Debugging. I have run into the above situation I describe before so I'll leave this answer posted for those who come along who do have such an issue.
"Wait for debugger"in Developer options may have been set to wait your application.
Do check once that you placed breakpoints. Run app once and if you get the same message do debug as-> debug configuration-> select the app which you need to run and select always prompt to pick device.It will work for sure. It may be stupid, but i faced this problem for a long time and i tried this and this helped me. And if needed restart your device. Thanks
For me, I use Android Studio 2.1.2I, I click on Menu Run > Attach debugger to Android process
There is only 2 lines
__device_name
____app_name
I just select app_name(want to run) and click OK then miracle happens.
I had the same problem.
But restart my Device or clear the Breakpoints don't worked.
I tried :
Run --> Attach to Android Process.
Select your package and press OK.
and it works :)
There was so many adb processes running ,I kill them all and its start debugging
You can also set your Android App as Debugging-App
Settings --> Developer Options --> set Debuging-App
there you can choice your app
You might have added your app in Select app to be debugged on your phone. In Settings -> Developer Options -> Select app to be debugged
To resolve this, go to Select app to be debugged and click on No apps
Your manifest file may contain following permission
Just remove this permission
<uses-permission android:name="android.permission.SET_DEBUG_APP"/>
It seems like every step I take in the Android world I run into problems.
Usually, I have my HTC Hero connected to the computer via USB and I launch the application either in debug mode or in normal mode.
So, the last time I ran the app in normal mode. Then I disconnect the device (I want to try to have it "free", not connected to computer) and I start the app from the menu. When I do that I get a popup saying "Application xxx is waiting for the debugger to attach" and there it stops and eventually dies.
Why is it waiting for the debugger, when the last time I ran the app (while connected) I didn't run it as Debug?
Edit 1
I might add this little weird fact:
If I do "Run" (green/white arrow) when the device is connected I still get a popup on the device saying "Application xxx is waiting for the debugger to attach".
Edit 2
Found this page. He restarted his device and that worked for me too. Stupid not to try that right away...
Just to close this question: I restarted the device, and that helped.
For me, the solution is to select "None" in "Developer Options"->"Debug"->"Choose debug application", though it already has "None" selected.
Seems like the device put a "need to debug" label on my app sometime before which is still there when I "Run" the app on the device using my IDE (or even launch the app manually when the device is not connected to PC), and re-select "None" removes the label. Don't know whether it's the case.
Restarting is more time taking, Easier way is that in the device, select "Developer Options" > “Select debug app” and select "Nothing".
Also, don't forget to go into your Android Settings under "Development Options" and unselect "Wait for Debugger"
You could also try removing the android:debuggable="true" from your AndroidManifest.xml file when you want to test the application by itself. Turning off development options in the preferences menu will help also.
I assume you are using Eclipse. Are you sure you are pressing the green circle with a white arrow and not the green bug button? Try closing the project, reconnecting the Hero, open the project and click the green/white arrow.
With your Edit1 - Try uninstalling the application from the Hero and try again.
With you Edit2 - I believe that will turn off all debugging capabilities. Good luck.
One more solution :)
In Android Studio 2.x follow these steps:-
1. Run the application:- Run Menu -> Run "app-name"
2. Attach debugger to process:- Run Menu -> Attach debugger to Android Process
"Wait for debugger"in Developer options may have been set with your application. Hence the application for debugger to attach.
Turn off Developer option and turn it back on.
Other than setting Select debug app to none, In android 9 and above (haven't check if exist in Android 8 but doesn't exist in Android 7) need to un-check Verify apps over USB
I recently upgraded my device from Android 7 to 9 and suddenly all my own apps (developed by me and are not signed) stopped working. disabling option mentioned above made them all work again.
I fixed it by turning off "Developer Options" in settings and then turning it back on again.