I'm trying to fix a seemingly random crash in my app. The problem is, I've left it connected to my debugger in Android Studio for hours and it won't crash. In fact, it only crashes when the app is not in the forefront. I'm pretty sure it has to be related to my broadcast receiver, but I can't reproduce it at will.
Is there any way I can recover the logcat from the crash if I attach the debugger after a crash? Is there an easy way to log to a persistent file?
Create bug report on your phone and send it to your email. After that you could search for your app package crash information.
You can make bug report under Developers options in phones settings or you can enable Power menu bug report (more convenient) under the same Developers options section.
Egor had the answer. I thought my error was not showing in my logcat because either things were showing up out of order in my logcat or Android Studio was showing me things that happened over half an hour ago. Basically, I connected the debugger and saw that the first thing in the logcat was about updating the app and connecting the debugger, and so assumed that I had missed whatever came before. The error was about twenty lines down from there.
Related
for unknown reason my phone create too many logs without any application tag.
it's so rapidly that my own app's log wont last more than 2 second.
someone has already asked but nobody has answered yet.
Real device produce too many log
you gotta cancel all the background process that are running in you device, and some logs which you have mentioned are general log which will be constantly running in all the android device
Select show only selected application. Check this android developer resource
Today I decided to update my Android Developer Tools. I am currently on version 22.3. Anyway, just after the update, logcat and eclipse have been behaving differently. As soon as I plug in the phone to the computer, logcat starts logging everything from the phone: EVERYTHING. SO as I browse some other apps and do stuff around it just keeps logging. So I see all the system calls and touch recognisers reports among all other stuff.
That is not much of a problem, it is annoying though, but once I start debugging my app it just keeps going on and on. Granted I use the session filter to only see logging related to my app. But eventually the full log increases till reaching those many entries as in the picture and eclipse starts to slow down everything. So as I am debugging my app, eclipse keeps getting slower and slower. Until our beloved beach ball kicks in and makes my life miserable once again. So far I have restarted eclipse like ten times today due to this behaviour.
This used to happen before, but as a bug, which restarting the phone or restarting eclipse used to stop. Today, nothing seems to be working. Is this now a feature? Is there any way for me to stop logcat from logging everything and only do it when I am debugging the app as it was before?
Any help is deeply appreciated.
Select specific option based your requirement
http://developer.android.com/reference/android/util/Log.html
While writing the log always try to use appropriate method as per the log type for example-
Log.d(TAG, "Message");
Log.e(TAG, "Message");
Log.v(TAG, "Message");
Log.w(TAG, "Message");
Log.i(TAG, "Message");
Then you can easily filter you log. As mentioned in answer by "shylendra" it will easy to monitor.
In Android Studio Dolphin | 2021.3.1 add package:mine in Logcat search bar. Using this filter you will see only your local app logs and errors.
See more here
The title speaks for itself, but I would add some pointers I've noticed along the way.
I would like anyone who also experiences the end result while developing for Android to try to reproduce this and see if this scenario is really the case.
The crash happens when Logcat is overpopulated. By overpopulated I mean that from a point in time, if you would leave a device connected in debug mode for a while, and you would look at the Logcat view, it would display only the new 'delta' lines added to the log in the past short interval of about two seconds.
If you would pay attention, while the Logcat is overpopulated, the device which is been debugged, responds slowly to user interaction (this can be your indication, that the Logcat is overpopulated while testing your application), and perform other actions ridiculously slow.
If you would leave the device connected and more logs would be added, there is a short interval 5-10 seconds, where Eclipse starts to behave weird, and after that, there is nothing you can do, Windows 7 freezes and only hard reboot allows you to get back to work.
I can reproduce this every time, if I would just leave a device connected in debug mode with an application running.
I've Googled this and came up with nothing. I assume that if me and my colleagues encounter this (we have the same Eclipse setup), then other should also experience this, so before posting a bug, I would like to confirm this...
Details:
Windows 7
Eclipse 3.6
ADT 10.0.0.v201102162101-104271 (latest for today)
I have the same problem here. I've been troubleshooting this for months! Mostly because it's been extremely difficult to find anyone with the same issue. (I was actually linked to this post from the bug report that Android Developer provided.)
I've been working with someone on a similar Stack Overflow issue. He thought the problem was his IDE until I reported that I was experiencing the same issue, but with a different IDE. Together, we've been able to whittle the problem down to either the device itself or the drivers. We recently just excluded the USB cables as the culprit.
However, the problems reported in the Google bug report are exactly what we've been experiencing. It makes sense that ADB might be where the problem ultimately lies.
Hopefully, this post will help create some search-friendly connections between the other posts.
Other Stack Overflow post mentioned above -- Android development in IntelliJ IDEA causes computer to freeze
Google bug report, Issue #24171 (originally posted by Android Developer) -- http://code.google.com/p/android/issues/detail?id=24171
I also have a similar problem. Sometimes, the Windows OS completely freeze when an Android device is connected.
I'm not sure why it happens, but I think that it only occurs when the ADB is active.
Here's a bug report I've found recently about this:
adb causes whole Windows operating system to freeze randomly
After using a USB from the back, and installing Windows 8, the problem doesn't occur any more.
However, it's Windows 8, and I wish I used Windows 7. For some reason, Microsoft didn't provide a way to go back...
Try setting your Eclipse Android Settings for the maximum amount of logcat messages in the buffer to a lower value.
This should help
I don't want to jump to conclusions, but I think I've found the real issue which causes this halt...
I'm going to make some assumptions, and if one of these does not fit your scenario, let me know:
Assumptions:
This only happens on a chargeable computer... Be very very sure before dismissing this assumption.
This happens when a laptop is connected to the adapter, and is being charged.
Cause:
This happens when you use a custom adapter, and not one that 100% fit your computer.
According to my experience, once I've used my home adapter on my work computer, the crash reoccurred over, and over, and over... drove me nuts... and when I got back to work, and used the proper adapter, the issue vanished!
Same with my home computer, and work adapter.
Lend me your thoughts...
I've been lazy with debugging for the past couple of years with easy school projects and have just used print commands to see what was going on in my programs, but now I'm working with something more sophisticated where that just won't do, and I've found that I've forgotten how to debug.
I was getting the message "android.jar has no source attachment" when stepping into just about every other line of my code. I decided to backtrack and try to "debug" a working app of mine just to see how it works, and got the same message.
I've never used logcat before either and am not sure that I'm doing it right or what stuff means, but I typed the command "adb logcat" and a lot of text started coming up... But one line that caught my eye right around the time I stepped into a line that caused the "android.jar has no source attachment" error was: "Launch timeout has expired giving wake up lock!"
What do these things mean, and how do I fix them? These errors are coming up with a program that runs perfectly well when not debugging.
Some other possibly relevant information is that I'm using Eclipse and an Android 3.1 tablet.
Logcat is just a place where applications can log messages, just like you printed commands to check the status of your program. This link explains how to log to logcat within an application. What kind of debugging are you looking to do? If you want to see your threads, go to the DDMS perspective in Eclipse, select you device (it has to be plugged in) and process, and click update threads. You will see the running threads in the Threads view.
Also, stepping into lines in your code will try to take you to the android library's code, but you do not have the source attached. Step over the lines instead to keep debugging in your own code, not the Android library.
More info on Android debugging: http://developer.android.com/guide/developing/debugging/index.html
I use IntelliJ IDEA to write Android apps, and use the DDMS Windows application to view the Android logs (separate from the IDE). It works fine, but after a seemingly random period of time, the logs vanish, except for one line of log, which gets overwritten with incoming logs. I have to shut it down and restart it, which combined with the delays of deploying an app to a device over ADB to debug and test is pretty tiresome.
Is this a known issue with DDMS? Is there anything I can do to make it work consistently without breaking itself?
Are there any other Android log viewing applications for Windows that work better? I'm not very fond of the IntelliJ IDEA one. My favourite is actually CatLog on Android itself, but on a small-screen device it's not a great experience.
It's not about the time, but number of lines being recorded. As Dave C said in the comment, just clear the log and it will be fine
Have you tried looking at "Why doesn't LogCat show anything in my Android?"? The top voted answer may solve your problem