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
Add the Crash Reporter dependency to your module's build.gradle.kts:
dependencies {
debugImplementation("ai.snapbug:snapbug-crashreporter:0.1.0")
releaseImplementation("ai.snapbug:snapbug-crashreporter-no-op:0.1.0")
}Or with version catalog:
[libraries]
snapbug-crashreporter = { module = "ai.snapbug:snapbug-crashreporter", version.ref = "snapbug" }
snapbug-crashreporter-no-op = { module = "ai.snapbug:snapbug-crashreporter-no-op", version.ref = "snapbug" }The Crash Reporter automatically captures uncaught exceptions once the plugin is included. No additional initialization code is required beyond the standard SDK setup.
Always use the -no-op variant 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: ^0.1.0Initialization
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 uncaught JavaScript exceptions.
Installation
npm install snapbug-react-nativeInitialization
import { Snapbug } from 'snapbug-react-native';
Snapbug.start(); // crash reporter enabled by defaultManual 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.