Cause a Test Crash¶
You can check to see whether crash reporting has successfully been added simply by throwing an uncaught exception, e.g.:
throw new RuntimeException("This is a crash");
Crashes are sent from your app after it’s been reopened, so be sure to place this line outside your
Application class, or the
onCreate() method of your launch
Activity; adding a button to trigger the crash often works very well.
We process crashes in real-time. If we detect that a crash is due to a new issue, it will show up as a new issue on your dashboard. If it’s a reoccurrence of an existing issue, that issue’s crash counter will be incremented and the information from the new crash will be included into the issue.
If you’re not seeing crashes, check the following common causes of delays:
- Make sure our SDK initialization line is after all other 3rd-party SDKs
- Force a crash and then relaunch the app.
- If you’re using our
Crashlytics.getInstance().crash()method for testing purposes, make sure it’s not in the onCreate method of your launch Activity
- Check your network connection to be sure that it’s stable and able to send up crashes. Keep in mind that exceptions are not guaranteed to cause a crash. The full code path, including code in system libraries matters here. Devices and emulators and different OSes will have different behaviors regarding which types of errors actually cause crashes, especially when the UI thread is involved.