How can I read the error log applications make? Is there any software which reads the error log from the handset and displays it?
I don't want to debug the app using eclipse, I'm looking for a handset based error log viewer.
There are a number of free applications in the Android Market which will collect the device log.
One which looks promising is Log Collector, not least because it is open source. You can find it on Google Code here and on androlib.com here.
Here's another Log Collecting app produced by the creators of Locale.
I quite like the one I wrote ;-)
It's called SendLog
http://l6n.org/android/sendlog.shtml
Alogcat seems OK. It's a bit verbose, though.
Related
The question may sound stupid, but I'm explaining:
I'm not 100% sure how logcat Works, but I think it's safe to guess that it reads internal produced messages from the app it's monitoring.
I think it would be possible to also get to read these messages in the way that logcat "would be added" to the app and it would be possible for example to put a thread that would search patterns in that "logcat added to the app" and produce some action, same way a developer searchs for certain patterns to make the app work. This way it would be possible to get a detailed log of what have been the actions of an user that may cause an error in the app for example, withouth the need of having to plug the pone in the computer and trying to reproduce the error.
But maybe logcat is something extremely complex on its own, and what I'm saying is total nonsense for any practical purpose.
Is it feasible what I'm mentioning?
logcat is reading stack traces. You can place your project inside a try and in the catch, redirect the stack trace to a database or whatever. In our project, we have Acralyzer added as a dependency and it sends all errors to our server. Note that we aren't using that horrid CouchDB-we are custom-parsing the json ourselves. We do this on deployed apps so we have a stack trace of exactly what line in the program failed. This is almost always enough information. "null reference" is pretty explanatory for example.
I've seen plenty of ways of getting system logs in Android with logcat and the like, but not so much about app logs (except for the usual USB + adb solution).
My B2B Android app produces useful logging created with Log.i calls. Whilst in Studio these are very useful for debugging, it would also be useful to get these from customer's installs when things go wrong, i.e. from a release build out in the wild. Customers are generally not techies so getting logs via adb isn't really an option.
Is there a way within the app code itself to grab all the log contents?
Perhaps the SDK provides a way to do this?
I could then send that to my server or by email. I'm thinking it'll be useful for my customers to just hit a button so I can get an instantaneous snapshot of what is happening in the app.
Thanks in advance
UPDATE
There doesn't seem to be a way to do this, aside from writing to a file and sending that file. Which I guess is a good a solution as any.
Two other interesting ones that have come up are:
Firebase (from Mohammed's comment) - can log events:https://firebase.google.com/docs/analytics/android/events
Instabug
we can write write logs to file using java.util.logging.Logger API.
How to write logs in text file when using java.util.logging.Logger
Check out here for writting crash log to a file
I am trying to leverage my very modest Ruby experience with Ruboto. I have installed the necessary packages, and the various demos work well on the simulator (on Windows) and on my Android device. I have been able to write some very simple Ruby scripts for Ruboto, but when they don't work, I have no visibility over what is happening. The only error message I get is: "Unfortunately, xyz has stopped."
I assume there must be a way to troubleshoot a Ruboto script and get a log or some kind of detailed information on the reaction of the system to each line of code.
I have been googling that question for a while without success, and I apologize if I missed something obvious. I also tried "adb catlog" without getting any useful information related to the Ruby script, but maybe I was not able to find the right information in the thousands of line generated by this command.
I hope someone can point me in the right direction.
Thanks
At the moment, the debugging options for Ruboto are limited and low-tech.
You can analyse the log using "adb logcat" or the newer "rake log". "rake log" uses "adb logcat" but applies a filter so you get much less noise. If your app crashes, you should see a Ruby stack trace with the immediate cause of the crash. This is probably what most Ruboto developers use now.
Another option is to encapsulate a risky method with a "rescue" that either logs a better message, or displays the error in a dialog. This would probably be more helpful, but requires a bit more work. You could request this as a Ruboto feature in the Ruboto issue tracker :)
Would something like "debugger" work here?
It would be awesome if it could...
Please note, unlike many other questions having the subject title "application has stopped unexpectedly", I am not asking for troubleshooting a particular problem.
Rather, I am asking for an outline of the best strategy for an Android/Eclipse/Java rookie to tackle this formidable task of digesting huge amounts of information in order to develop (and debug!) a simple Android application.
In my case, I took the sample skeleton app from the SDK, modified it slightly and what did I get the moment I try to run it?
The application
(process.com.example.android.skeletonapp)
has stopped unexpectedly. Please try
again.
OK, so I know that I have to look LogCat. It's full of timestamped lines staring at me... What do I do now? What do I need to look for?
Is there a way to single-step the program, to find the statement that makes the app crash? (I thought Java programs never crash, but apparently I was mistaken)
How do I place a breakpoint?
Can you recommend an Android debug tutorial online, other than this one?
I'm an Eclipse/Android beginner as well, but hopefully my simple debugging process can help...
You set breakpoints in Eclipse by right-clicking next to the line you want to break at and selecting "Toggle Breakpoint". From there you'll want to select "Debug" rather than the standard "Run", which will allow you to step through and so on. Use the filters provided by LogCat (referenced in your tutorial) so you can target the messages you want rather than wading through all the output. That will (hopefully) go a long way in helping you make sense of your errors.
As for other good tutorials, I was searching around for a few myself, but didn't manage to find any gems yet.
Filter your log to just Error and look for FATAL EXCEPTION
If you use the Logcat display inside the 'debug' perspective in Eclipse the lines are colour-coded. It's pretty easy to find what made your app crash because it's usually in red.
The Java (or Dalvik) virtual machine should never crash, but if your program throws an exception and does not catch it the VM will terminate your program, which is the 'crash' you are seeing.
Check whether your app has the needed permissions.I was also getting the same error and I checked the logcat debug log which showed this:
04-15 13:38:25.387: E/AndroidRuntime(694): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:555-555-5555 cmp=com.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{44068640 694:rahulserver.test/10055} (pid=694, uid=10055) requires android.permission.CALL_PHONE
I then gave the needed permission in my android-manifest which worked for me.
From the Home screen, press the Menu key.
List item
Touch Settings.
Touch Applications.
Touch Manage Applications.
Touch All.
Select the application that is having issues.
Touch Clear data and Clear cache if they are available. This resets the app as if it was new, and may delete personal data stored in the app.
I've read the lame documentation, and checked other answers. I'd like my Android app to print some debug statements in the logcat window of Eclispe. If I use the isLoggable method on the various types of debug levels on the Log class, I find that WARN and INFO are returning true.
Log.w, and Log.i do not produce any output. Does anyone know which gotchas I've missed?
And just to vent, why should this be hard? I've published apps for iphone and bberry and while appreciate the use of java, the platform is reeking of too many "genuiuses" being involved. I suppose Activities and Intents are very flexible, but why? I just want to put up some screens, take some input and show some results. The bberry pushscreen and popscreen is a lot less pretentious.
Thanks,
Gerry
The problem with debugging with Android in Eclipse is that from Eclipse's point of view, you're debugging the emulator and not your specific app. The emulator isn't crashing, so there aren't any logs to show. What you need to use is LogCat, Android's debugging plug-in. See this answer for details on how to bring that up.
It is not clear to me what the problem is. I use "Log.d(TAG, "special message");" all the time in Eclipse in Android code running in the emulator. Since you say "Log.w" gives no output, I assume you already know about the need to import android.util.Log. Otherwise you would not have got even that far.
The only other thing I can think of is for you to check your Eclipse Preferences under Window>Preferences>Android>DDMS (DDMS is needed for Logcat). Make sure the timeout is reasonable (mine defaulted to 5000mS). Make sure the base local debugger port is open, too.