I'd like to examine stack traces from the last hours. I haven't found a proper logcat command. Does Android "forget" those logs?
First story:
When I find an unhandled exception in my co-workers Iphone App, he connects the iphone to his computer and reads the stack trace into x-code. X-Code also visualizes the exception in a nice way.
Is there a smth. similar in Android?
You probably won't be able to see those logs from the past hours. Imagine that your phone stores all logs, how much space will it consume in a couple of days?
So, this is what I do:
I'm in the autobus, and suddenly the app I'm working on crashes!
I'd like to see what's the logcat output to analyze it at home
I just launch the Android log collector app, and send myself an email with the logcat output
I get home, have dinner, feed the dogs and then I can start working on the logtrace I emailed hours ago.
Related
I'm seeing a small amount of logcat entries for my app since Android 13. I can usually only see a few minutes before plugging the phone in to check the logcat. If I leave it plugged in it doesn't clear and I can see as far back as I could when I first plugged it in. It's as if something is clearing the logcat. I have increased the log buffer size to 4M and then 8M and it's still the same. I should be able to see logcat entries from the previous day with such big log buffers. It's also the same whether checking the logcat from Android Studio or from the phone itself with a logcat reader app.
What should I check to solve this?
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.
When testing on real Android devices, I run my application from within Eclipse and have access to the logs and errors using DDMS and LogCat.
However, there is one device I own that I cannot connect to my PC, and therefore I cannot view on DDMS.
When this application loads, it throws an Exception. However, I have no idea what this Exception is.
How can I view such errors or logs on a real device?
Install a logcat viewer such as aLogCat. It provides various ways for you to view, save or share the log output.
To answer your question more generally, you can include BugSense, whenever your application crashes on your clients' devices, it will automatically send the crash report to you, including useful info like stacktrace, Android OS version, screen dimensions, device name, etc...
I didn't realize how buggy my applications really are in the field until I started using it.
There is a bunch of logcat reader apps - like CatLog or aLogcat, capable of viewing logs, filtering or saving them to the external storage. Just search the Market for "logcat".
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
Ive developed some app for Android,
the Weirdthing that on the emulator it's pretty stable, but when i tryied on real device of a friend(nexus), it crushes times to times, cant finger on a specific case when exaclly it happens.
i realy want to distribute the app asap, but i cant find any leaks in my emulator.. what I should do? how can i debug my app and find the reasons for it to get crush on real device..
Thanks,
Idan
Plug the Nexus One into your PC, and view the stack trace when the app crashes. If you want to know why your app is crashing you've got to get to those stack traces.
You can tell your friend to download http://code.google.com/p/android-log-collector/ from the Android market and run it right after a crash. It'll give him an option to share his recent logcat in various ways.
Some things may be private to him (like what programs he has ran) so he can email it to himself and forward you just the parts about your app.