---
title: Configure the New Relic Gradle plugin
source: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/install-configure/configure-new-relic-gradle-plugin
---

The New Relic Gradle plugin extension allows you to configure the behavior of plugin tasks executed during Gradle builds. Create a plugin extension in the Gradle build files that apply the New Relic plugin, then add any of the following configuration options:

| Config option                   | Description                                                                                                                                                                                                                                                                              |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `variantMapsEnabled`            | Generate unique build IDs for each app variant. Build IDs are unique identifiers assigned to each build of your app. They're helpful for tracking specific builds, especially when you have different versions with multiple builds, such as version 1.1.1 build 0.0.1. Default: `true`. |
| `uploadMapsForVariant`          | Specify which variant build types should report ProGuard maps to New Relic. For React Native apps, this also controls which variant build types automatically upload the JavaScript source map. Default: `Release`                                                                       |
| `excludeVariantInstrumentation` | Exclude specific variants from instrumentation during builds. Default: 'None'                                                                                                                                                                                                            |
| `excludePackageInstrumentation` | Exclude specific classes whose package name starts with or includes class name patterns from instrumentation during builds. This feature can help when encountering sensitive or problematic class data.  Default: 'None' Supported when used with Gradle 7.4 and higher.                |
| `logInstrumentationEnabled`     | Replaces Android Util Log Classes with NewRelic Log Method for log reporting - Default: `true` Supported when used with Gradle 7.4 and higher.                                                                                                                                           |
| `defaultInteractionsEnabled`    | Set to `false` to create `DefaultInteractions` for Activities and Fragments. - Default: `true` Supported when used with Gradle 7.4 and higher.                                                                                                                                           |
| `webviewInstrumentationEnabled` | Set to `false` to disable webview instrumentation. - Default: `true` Supported when used with android agent v7.6.15 and later.                                                                                                                                                           |

Here are some simple examples showing how to apply plugin configuration options to the agent:

**App-level build.gradle example**

To configure the plugin with default values:

````gradle
newrelic {
    // use a common buildId for all variants (default: true)
    variantMapsEnabled true

    // Tag and report Proguard maps for these build types (default: Release)
    uploadMapsForVariant("Release")

    // instrument all variants
    excludeVariantInstrumentation("")

    // Exclude sample classes from instrumentation (regexp supported)
    excludePackageInstrumentation("")

    // Enable log instrumentation
    logInstrumentationEnabled true

    // Enable the Default Interaction
    defaultInteractionsEnabled true

    // Enable webview instrumentation
    webviewInstrumentationEnabled true
}
```

````

**Enable map uploads for multiple variants**

Multiple build types can be specified, separated by commas. For React Native apps, adding `Debug` here also enables automatic upload of the JavaScript source map for debug builds:

````gradle
newrelic {
    // default build types
    uploadMapsForVariant("Release", "Debug")
}
```

````

**Disable map uploads**

To disable map uploads entirely, use an empty string:

````gradle
newrelic {
    // disable map uploads
    uploadMapsForVariant("")
}
```

````

**Disable instrumentation of debug variants**

Multiple build types can be specified, separated by commas:

````gradle
newrelic {
    // exclude debug build types and flavors
    excludeVariantInstrumentation("Debug", "QADebug")
}
```

````

**Disable instrumentation of specific classes**

You can specificy multiple package patterns, separated by commas, with support for Regexp patterns:

````gradle
newrelic {
    // Don't instrument sample classes
    excludePackageInstrumentation("com.sample", "org.bouncycastle.*")
}
```

````

**Disable log instrumentation**

To disable log instrumentation:

````gradle
newrelic {
     // disable log instrumentation
    logInstrumentationEnabled false
}
```

````

**Disable Default Interactions**

To disable default Interactions for Activities and Fragments:

````gradle
newrelic {
     // disable default interactions
    defaultInteractionsEnabled false
}
```

````

**Disable Webview Instrumentation**

To disable webview instrumentation

````gradle
newrelic {
     // disable default webview instrumentation
    webviewInstrumentationEnabled false
}
```

````
