I do not know whether people often encounter this situation: their own projects are sometimes not connected to the computer crashes, and finally found that the results of the bug connected to the computer can not be reproduced; It's not that easy to start a machine that wants him to play log.
at this point we need to write the program's crash information to the local file, so that we do bug repair.
This project is open source discussion, on the project source (with Javadoc), as well as packaged jar package and the user Manual of the jar package.
If crossing read the source code, it has comments and should be easy to understand.
If crossing wants to use it directly, see the user manual below.
It is recommended that you refer to the project directly using the jar package, so that you do not have to paste the source code for each item.
Cut *****************************
1. Download the Crashhelper.rar, extract the Crashhelper.jar files, and copy the files to the Libs folder of the project. And right-click Crashhelper.jar-->build path-->add to Build path. As shown
<ignore_js_op><ignore_js_op>
(Note: Because the editor may not see the same view effect, I use ADT v21.0.1 is directly integrated by eclipse in Google's Adt-bundle-windows.rar)
The new ADT can be directly included in the Libs jar or library directly into the Android dependencies, there is no need to manually add to the build path, more intelligent!
2. Use the following 2 methods in OnCreate in custom application in your own project:
Public class MyApplication extends application {
/**
* (Non-javadoc)
* @see Android.app.application#oncreate ()
*/
@ Override
public void OnCreate () {
Super.oncreate ();
Crashhandler Crashhandler = Crashhandler.getinstance ();
Crashhandler.init (this);
}
}
3. Declare the custom application as the program master application in Manifest.xml, and don't forget the right to write the SD card
<ignore_js_op>
After 3 steps to use this jar package, your own project can be placed on the phone with carry, run a day to see the SD card root directory under the/crashinfos/folder to collect error messages
<ignore_js_op><ignore_js_op>
The following is an attachment
<ignore_js_op>crashhelper.zip (799.77 KB, download number: 237)
************************************************************
Careful friend may find that once the feature is added to the project, all of the crash error messages are saved to the SD card, the connection to us is greatly reduced efficiency, so the author again update the jar package, so that the file is saved at the same time the error log output to the console, dual-tube output. For example, take a look at the time to know that the same exception is output to 2 places.
<ignore_js_op><ignore_js_op>
Now the new jar package and the source
<ignore_js_op>newcrashhelper.zip (1.04 MB, download count: 784)
[Open source Class library/project] Android save crash error message log to local "source +jar package + Use said ...