Test it
Let's crash your app to see what the crash report looks like on your Shake dashboard.
Crash your app
Enable crash reporting and paste this code to the onCreate
method in one of your activities.
It will crash your app when you tap a button by accessing the array with the out-of-bounds index:
- Java
- Kotlin
MainActivity.java
public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Button buttonCrash = findViewById(R.id.button_crash);buttonCrash.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {int[] array = new int[]{1, 2, 3};int result = array[5];}});}}
MainActivity.kt
public class MainActivity : Activity {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_main)val buttonCrash: Button = findViewById(R.id.button_crash)buttonCrash.setOnClickListener {val array = arrayOf(1, 2, 3)val result = array[5]}}}
Reopen your app, describe the crash and tap Submit.
Visit your Shake dashboard
To see your crash report:
- Visit your Shake dashboard
- Switch to the Crash reports tab in the left sidebar
If your crash report is not visible instantly, wait a minute until the system processes it.