Crash Reporter
The Crash Reporter plugin captures and displays crash logs and uncaught exceptions from your app in real time. View full stack traces, exception types, timestamps, and thread information directly in the Snapbug inspector.
Features
- Automatic capture of uncaught exceptions
- Native iOS crash capture (
NSExceptionand POSIX signals) - Full stack trace viewer
- Exception type and message display
- Timestamp and thread information
- Manual error reporting API
Android Setup
The Crash Reporter ships inside the all-in-one Android SDK, so the standard pair from Android SDK is all you need:
dependencies {
debugImplementation("ai.snapbug:snapbug:1.0.4")
releaseImplementation("ai.snapbug:snapbug-no-op:1.0.4")
}Do not add snapbug-crashreporter next to it: in release it lands next to its no-op twin and the build fails with Duplicate class.
The Crash Reporter is part of the default plugin set and captures uncaught exceptions once Snapbug.start(this) runs. No additional initialization code is required.
Always use snapbug-no-op for release builds to ensure zero overhead in production.
iOS Setup
On iOS the Crash Reporter is enabled automatically by Snapbug.start(). It captures:
- Uncaught
NSExceptions viaNSSetUncaughtExceptionHandler - Fatal POSIX signals --
SIGABRT,SIGSEGV,SIGBUS,SIGILL,SIGFPE,SIGTRAP
Crash reports are persisted on the device and delivered to the inspector on the next launch if the app dies before the report can be sent.
Flutter Setup
The Flutter plugin captures Flutter framework errors, uncaught Dart exceptions, and isolate errors.
Installation
Add the dependency to your pubspec.yaml:
dependencies:
snapbug_flutter: ^1.0.4Initialization
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Snapbug.start();
runApp(MyApp());
}Manual Error Reporting
try {
// risky operation
} catch (error, stackTrace) {
SnapbugCrashReporter.reportError(error, stackTrace);
}Automatic capture of Flutter framework errors is opt-in on the Dart side: pass SnapbugCrashReporter(catchFatalErrors: true) in the plugin list of Snapbug.start(). For more granular control, keep it off and use reportError to send specific errors manually.
React Native Setup
The React Native plugin captures native crashes automatically and uncaught JavaScript exceptions when enabled (see below).
Installation
npm install snapbug-react-nativeInitialization
import { Snapbug } from 'snapbug-react-native';
Snapbug.start(); // crash reporter enabled by defaultNative crashes are captured by default. Uncaught JavaScript errors are opt-in: replace the default plugin list and keep the others, Snapbug.start({ plugins: [new SnapbugNetwork(), new SnapbugAnalytics(), new SnapbugCrashReporter({ catchFatalErrors: true }), new SnapbugLogs()] }). The handler is installed once the app connects to the inspector. The catchFatalErrors option of Snapbug.start itself applies to native crashes only.
Manual Error Reporting
try {
// risky operation
} catch (error) {
SnapbugCrashReporter.reportError(error);
}Viewing Crash Reports
Once connected to the Snapbug inspector:
- Select Crash Reporter from the left sidebar.
- Crashes appear in real time as they occur.
- Click on a crash entry to expand the full stack trace.
- Use the search and filter tools to find specific exceptions.