How to resolve when Logcats stops working in Android Studio? - android

Logcat has stopped working for me again in Android Studio. Last time it happened I had to reinstall the IDE, and I want to avoid it again.
What I did for this to happen was changing...
Log.d("WRONG", "TEST");
to
Log.d("LOG", TEST");
and then changed the tag back to "WRONG" again. Now Logcat wont show any of my debug messages even if I remove WRONG from the filter when the app is running on my phone. The emulator still provides debug messages.
I already tried:
Checked if Android Device Monitor is active.
Restarting Logcat.
Change from Verbose to Debug and back to Verbose.
Unplugging the phone.
Restarting Android Studio.
Invalidate cache / Restart (in File menu).
Uninstalling the app.
Restarting the computer.
All of the above at the same time.
Changing phone.
Switching USB cable.
Opening Android Studio Manager. It bugged out and the log told me »java.io.IOException: The folder "C:\Users\Logga%20in.android\monitor-workspace.metadata" is read-only.«
[edit: tried even more solutions]
Using the terminal in Android Studio. Going to android sdk\platform-tools folder and typing adb kill-server followed by adb start-server.
opening Dalvik Debug Monitor through Command and checking the log there.
adding android:debuggable="true" to the manifest (under the application tag).
I'm using Android Studio 2.1 but the same thing happened when I was using 2.0b.

In my case in Android 2.2, for some reason, Firebase was selected by default in the dropdown box marked above. So logs didn't drop. I just needed to change it to No Filters
Hope this helps someone.

I finally got the log to start working again.
I did some updates in Android Studio, mostly just the repositories, but what I think was the real solution was to turn off my phone and have it turned off for about fifteen minutes. After that, the log started to work again.

try this,
Remove WRONG key word which is written in log cat search.
hope it will help you.

I selected no filter, cleared logcat buffer on device and then restarted the app and changed the filter back to "show only seleced application"
this ended up working for me :)

Reboot your PC. It happens to me once i restarted my PC worked fine.

To get a particular Logs from your application. You can use Create New Logcat Filter dialog which appears after selecting Edit Filter Configuration to create your own filter. And From filter option select My Tag

Mine stopped working twice in the past few weeks but it was not just log but the functionality I was implementing wouldn't work as well. I was running my code in an emulator. The solution was to plug in my phone and run it on my phone. It worked the first time on my phone. Only after it started working there did restarting the emulator work.

Related

Application is waiting for the debugger to attach

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

Why won't my logs be displayed in the logcat?

I'm using Eclipse Indigo and up until just a couple hours ago or so everything was working fine. When I just relaunched it and made a couple changes, I ran the program on my phone but my logs were not being displayed. The phone's logs are displayed in the logcat, but nothing from the project is. I have the device selected, I've tried restarting eclipse multiple times, I've reset the ADB, and I've run the commands adb usb and adb logcat (which still doesn't display my logs). I know my logs are correct: Log.e("Tag","Message"); Anyone have any other ideas?
As it turns out, it was a stupid error on my part. I had my logs set up as: Log.e("Tag","") instead of: Log.e("","Message"). Apparently, if you have the former, it won't display to the LogCat, go figure?
I think, you haven't selected device or emulator , on which running your application,
In eclipse go to DDMS Perspective and select device or emulator on which you are running your application.
(Note: No need to restart the Eclipse)

"Waiting for debugger to attach" showing even when not running in debug mode

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"/>

Can't disable auto debug

In the meantime of programming my app, it occurred, that even if i push the "run" button in eclipse (not the Debug one) the application starts in debug mode. Even if i pull out the Usb cable and start the app manually over the phone menu, it "waits for the debugger to attach"...
After deinstalling and reinstalling the manual start works well (w/o debugger) until I get an error. Afterwards always the debugger connects...
Can anyone explain me whats going on in "eclipses" or "androids" head here?
THX!
"Use the perspective DDMS , and run your app, and then , you will see the icon of debugging in the process of your app , uncheck it and it will work ;
if id didn't work , open the perspective Debug ,then, disable all the breakpoints , and it will work
"
or maybe you can try to delete the current run/debug cofiguration from eclipse proprties. Take a look on this
Tried a lot way on this but nothing works.
But I just fixed this by terminating the process with 8600 port through DDMS process list in devices view.
I had the same problem. Tried all the above and had no solution. I found my fix. Click on the Debug perspective button. Once it's selected, right click on it and then select 'reset'. This stopped the debugger from being called even when I was selecting "Run" and not "debug".
On further evaluation.. The following fixed my problem. The issue seems to be in the phone and not Eclipse.. this is a rare problem. I only found a hand full of people with same issue.
1) Uninstall app.
2) Hard reboot phone.
3) Reinstall app.
Now, eclipse won't go into debug mode even when all the preferences are set correctly and you select 'Run' and not 'debug'.
I had the same problem . Simply delete the app on the phone and reinstall it. Restart the device. It works for me.
I tried different ways without results:
delete all breakpoints.
restart Eclipse, DDMS

ECLIPSE ANDROID DEVICES DISAPPEAR

I have a problem with the Android emulator. After I run my application on a device it disappear from DDMS at some moment with no reason, even if it is still started. The only way to run again is to close the previous emulator and reopen it by running my application.
Do you have any solution for this strange error ? I must say that I can't deactivate my firewall if that is the problem. Also I tried to reset ADB but still doesn't work.
An answer for others that will come here looking for a solution.
You just need to restart ADB (kill-server and then start-server).
More details on how to do so: http://developmentality.wordpress.com/2010/09/13/android-disappearing-emulator-restart-adb-server/

Categories

Resources