---
title: Test crash reporting
source: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/test-crash-reporting
---

## Android

### Syntax [#syntax]

#### Java [#java]

```java
NewRelic.crashNow(string $message)
```

#### Kotlin [#kotlin]

```kotlin
NewRelic.crashNow(message:String!)
```

### Description [#description]

Throws a demo run-time exception named java.lang.RuntimeException to test New Relic crash reporting.

With this method, you can throw a demo run-time exception named `java.lang.RuntimeException` with a message. This crash will appear in the [Crash Analysis page](https://docs.newrelic.com/docs/mobile-monitoring/mobile-monitoring-ui/crashes/crash-analysis-group-filter-your-crashes).

### Parameters [#parameters]

| Parameter  | Type     | Description                                    |
| ---------- | -------- | ---------------------------------------------- |
| `$message` | `string` | Optional. A message attached to the exception. |

### Example [#example]

#### Java [#java]

```java
NewRelic.crashNow("This is my test message");
```

#### Kotlin [#kotlin]

```kotlin
dNewRelic.crashNow("This is my test message")
```

## iOS

### Syntax [#syntax]

#### Objective-c [#objc]

```objectivec
+ (void) crashNow:(NSString* __nullable)message;
```

#### Swift [#swift]

```swift
NewRelic.crashNow()
```

### Description [#description]

Throws a demo run-time exception named  `NewRelicDemoException` to test New Relic crash reporting.

With this method, you can throw a demo run-time exception named `NewRelicDemoException` with a message. This crash will appear in [the Crash analysis page](https://docs.newrelic.com/docs/mobile-monitoring/mobile-monitoring-ui/crashes/crash-analysis-group-filter-your-crashes).

### Parameters [#parameters]

| Parameter | Type     | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `message` | `string` | Optional. A message attached to the exception. |

### Examples [#examples]

#### Objective-C [#obj-c]

```objectivec
[NewRelic crashNow:@"This is a test crash"];
```

#### Swift [#swift]

```swift
NewRelic.crashNow("This is a test crash")
```

## Capacitor

### Syntax [#syntax]

```typescript
crashNow(options?: { message: string; } | undefined) => void
```

### Description [#description]

Throws a demo run-time exception to test New Relic crash reporting.

### Parameters [#parameters]

| Parameter | Type     | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `options` | `string` | Optional. A message attached to the exception. |

### Example [#example]

```typescript
NewRelicCapacitorPlugin.crashNow();
NewRelicCapacitorPlugin.crashNow({ message: "A demo crash message" });
```

## Cordova

### Syntax [#syntax]

```typescript
crashNow(message?: string): void;
```

### Description [#description]

Throws a demo run-time exception to test New Relic crash reporting.

### Parameters [#parameters]

| Parameter | Type     | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `message` | `string` | Optional. A message attached to the exception. |

### Example [#example]

```js
NewRelic.crashNow();
NewRelic.crashNow("New Relic example crash message");
```

## .NET MAUI

### Syntax [#syntax]

```csharp
CrashNow(string message = "") : void;
```

### Description [#description]

Throws a demo run-time exception on Android/iOS to test New Relic crash reporting.

### Parameters [#parameters]

| Parameter | Type     | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `message` | `string` | Optional. A message attached to the exception. |

### Example [#example]

```csharp
CrossNewRelic.Current.CrashNow();
```

## React Native

### Syntax [#syntax]

```ts
crashNow(message?: string): void;
```

### Description [#description]

Throws a demo run-time exception to test New Relic crash reporting.

### Parameters [#parameters]

| Parameter | Type     | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `message` | `string` | Optional. A message attached to the exception. |

### Example [#example]

```js
NewRelic.crashNow();
NewRelic.crashNow("New Relic example crash message");
```

## Flutter

### Syntax [#syntax]

```dart
crashNow({String name}) : void ;
```

### Description [#description]

Throws a demo run-time exception on Android/iOS to test New Relic crash reporting.

### Parameters [#parameters]

| Parameter | Type     | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `name`    | `string` | Optional. A message attached to the exception. |

### Example [#example]

```dart
      NewrelicMobile.instance.crashNow(name: "This is a crash");
      NewrelicMobile.instance.crashNow();

```

## Unity

### Syntax [#syntax]

```csharp
CrashNow(string message = "") : void;
```

### Description [#description]

Throws a demo run-time exception on Unity to test New Relic crash reporting.

### Parameters [#parameters]

| Parameter | Type     | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `message` | `string` | Optional. A message attached to the exception. |

### Example [#example]

```csharp
NewRelicAgent.CrashNow("this is crash");
```

## Unreal Engine

### Syntax [#syntax]

```cpp
crashNow(FString message): void;
```

### Description [#description]

Throws a demo run-time exception on Unreal to test New Relic crash reporting.

### Parameters [#parameters]

| Parameter | Type      | Description                                    |
| --------- | --------- | ---------------------------------------------- |
| `message` | `FString` | Optional. A message attached to the exception. |

### Example [#example]

```cpp
#include "NewRelicBPLibrary.h"

UNewRelicBPLibrary::crashNow("This is test");
```
