My application is basically a File Manager with junk cleaner. It is working fine everywhere but when i restart my phone Unfortunately app has stopped message appears several times. Also sometimes it appears when any other application is started. Can anyone tell why it is happening, or how to detect the cause behind it.
To detect the cause behind, you can monitor the logcat.
Since the crash occurs after the phone restart and so if you are not able to see the exception in log cat, you can log the same into a file to see the cause of exception.
Use the below link for how to log unhandled exception into file.
https://derivedcode.wordpress.com/2015/06/29/how-to-log-un-handled-exceptions-in-android/
Related
In my app when some services of it are running it suddenly displays that message on some occasions, but most of the time they work properly, when I've tested them I haven't had any problem.
I'd like to know if its possible to associate the event that causes that message to appear, with giving some extra information or at the very least writing a log that at least shows which class and what line of code causes the error.
From there I could investigate with greater ease what makes that message to appear, as right now I've no clue.
I'd like to know if its possible to associate the event that causes that message to appear, with giving some extra information or at the very least writing a log that at least shows which class and what line of code causes the error.
Every time that dialog appears, a Java stack trace is written to LogCat automatically. You can use Android Studio or other development tools to examine LogCat.
In my limited experience on a handful of Android devices, if an app crashes with an unhandled exception then that exception's written to the log. However I've come across a Samsung i8160 that doesn't. Other i8160s with various ROMs do. In fact, from boot, it doesn't log anything. It originated on eBay so the history is unclear, but rather than assuming it's an odd ROM and flashing something else I figured it was worth persisting in case the problem arises again elsewhere.
In researching, the first thing to try was to 'dial' *#*#2846579#*#* but this isn't recognised- it just tries to really dial that. There's a shorter *#9900# that does pop up a menu, but that only lets me dump the log and other info to files in /data/log for export. Since logging isn't up from boot, that doesn't export much.
Initially, /dev/log doesn't exist. One suggestion to fix this was to try logcat-enable from a shell. This isn't found. Another suggestion was to manually load the logging module by running insmod /lib/modules/logger.ko from a rooted shell. This brings logging up, but when an app crashes, all logcat outputs is
I/dumpstate( 8074): begin
I/dumpstate( 8074): done
I've found the dumpstate files, which include the logcat output, but there also it just notes creation of the dumps, not the exception that caused it.
As well as starting the module, I'm assuming somewhere there's some configuration determining what actions to take when an app crashes, and here it's not set to dump the exception and stack trace to the log because whoever did it figured logging wouldn't be running anyway. But I can't find anything like this. Does anyone have any ideas on how to progress further?
Some apps have a "report" function inbuilt in case their app crashes. When you choose report on the ANR message, usually a log is created for sending it to the developer. Maybe you can get an app to crash and catch that log (or maybe make your own one)
Is there any way I can get rid of this message despite the app being stopped due to any exception?
My app(background service) is designed in such a way that it always restarts itself within 1 mins in case it gets killed. So even if it gets stopped, it would be restarted again, with no negative impact. Hence that message would unnecessarily annoy/worry the users.
As the app works fine on my device, but on other's device, its giving that message once or twice a day. I have no way to read the logs and check whats going on. I have placed the try/catch block everywhere. And the code is too complex to dig into again and check whats wrong. In short, I don't want to get rid of the "cause" off the message. But the "message" itself. Is it at all possible?
So How do I get rid of android OS showing that message even if it has "stopped"?
So even if it gets stopped, it would be restarted again, with no negative impact
There is no way to know whether or not there is a "negative impact" until the source of the problem is found.
I have no way to read the logs and check whats going on. I
Use crash logging frameworks like ACRA to collect stack traces from production apps.
And the code is too complex to dig into again and check whats wrong.
Use the crash logs from crash logging frameworks like ACRA to identify the source of the problem.
Is it at all possible?
Read the documentation for your chosen crash logging framework and see what the options are for user notification regarding such crashes. Some, like ACRA, will offer a "silent" mode where the crash is logged but without informing the users of that crash.
Theoretically, you could set up your own Thread.setDefaultUncaughtExceptionHandler
I am facing a strange problem in my app. Sometimes an error Message comes as "Unfortunatly stopped" and I have to restart the app. It sudddenly occurs sometimes. I require help on two issues
1. What are the reasons why "unfortunately stopped" error occurs
2. Can we trap this error (I have put Try block, but it does not go there) and prevent the application from crashing
I suspect is related to performance issues, but not sure.
Grab a logcat just after the crash. You can do this in one of the following ways:
If you launch your app from Eclipse, it will show you a Logcat window.
Or issue adb logcat from the command line. (Assuming adb is in your PATH).
Or get a logcat app, such as aLogcat (https://f-droid.org/repository/browse/?fdid=org.jtb.alogcat).
The logcat will tell you the exception class that was thrown, any associated error message and the line in your code that caused the exception. If you need help analyzing the logcat, post it here.
When I connect my phone when Eclipse is running, in the LogCat it continues to write something without end, and prints some error messages all the time "Fatal signal something", whats wrong? Here's part of the log, it's still printing and doesn't sime like it will stop soon
http://pastebin.com/4Z58CiGm
These are all logs from system apps and processes, and you can safely ignore them.
You should tag all the statements from your app using:
Log.d("MyAwesomeTag", "Message");
Then you can filter them using tag:MyAwesomeTag and ignore everything that isn't yours