This project has been forked to carry on maintenance. We thank Alexander Pretzlav for keeping the original code and improvements.
This project is fork of Android Remote Stacktrace which adds a number of important features:
- Customizable interface for handling stacktraces
- Behaves better with the filesystem by saving stacktraces to their own directory, instead of your application's root documents directory
- Allows optional debug logging, which will also mark your application as a DEBUG build in stack traces
See also: javadoc
What follows is the original documentation for Android Remote Stacktrace, with small modifications for the few API changes made by me.
Download the latest trace.jar
file found here. Drop it into your Android project and in the properties for your project add it to "Java Build Path" -> "Libraries". Alternately, check out the source of this project, import it as an Eclipse Android Library Project, and add it as a library dependency to your app.
If you use the default HttpPostStackInfoSender
, you must enable internet access for your application:
<uses-permission android:name="android.permission.INTERNET" />
In the onCreate method of your activity or in your service, you must call either public static boolean register(Context context, String url)
(for the default HTTP POST behavior) or public static boolean register(Context context, final StackInfoSender stackInfoSender, final boolean debug)
found in the class ExceptionHandler. Do something like this:
ExceptionHandler.register(this, "http://trace.nullwire.com");
Or, using your own handler:
ExceptionHandler.register(this, new MyFancyExceptionSender(), isDebugEnabled);
If you wish to implement your own StackInfoSender, see the javadoc documentation for the interface.
If you would like to store your stack traces on your own server, you will have to register the exception handler like this:
ExceptionHandler.register(this, "http://your.domain/path");
At http://your.domain/path
the client side implementation will expect to find this simple PHP script, which will take three POST parameters: 'package_name', 'package_version' and 'stacktrace'. The collected data is simply stored in a plain text file. You can extend the script to send you an email with the stack trace if you like - just uncomment the last line and change the email address.
The JAR may be built by issuing the following command:
ant jar
This will produce a trace.jar file.
Cleaning up is done by:
ant clean
If you have problems, feel free to drop me a mail at mads.kristiansen@nullwire.com.
How to integrate stack trace collection with Redmine: http://nullwire.com/capturing_android_exceptions_remotely.
Thanks to these people, who contributed with code changes and/or bug reports.
Glen Humphrey, Evan Charlton, Peter Hewitt
The MIT License
Copyright (c) 2009 Mads Kristiansen, Nullwire ApS
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.