Skip to content

Commit c5fe5e4

Browse files
romtsnlizokmgetsantry[bot]
authored
chore(android): Add missing gradle configuration options (#8301)
Co-authored-by: Liza Mock <liza.mock@sentry.io> Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent fea8f41 commit c5fe5e4

File tree

1 file changed

+63
-5
lines changed

1 file changed

+63
-5
lines changed

src/platforms/android/configuration/gradle.mdx

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,42 @@ The `io.sentry.android.gradle` >= `3.0.0` requires [Android Gradle Plugin >= 7.0
4545

4646
### Configure
4747

48+
Set the auth token as an environment variable to be used when running your release build.
49+
50+
<OrgAuthTokenNote />
51+
52+
```bash
53+
export SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
54+
```
55+
4856
We expose the following configuration values directly in your `app/build.gradle`:
4957

58+
<SignInNote />
59+
5060
```groovy
5161
import io.sentry.android.gradle.extensions.InstrumentationFeature
5262
import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel
5363
5464
sentry {
65+
// Disables or enables debug log output, e.g. for for sentry-cli.
66+
// Default is disabled.
67+
debug = false
68+
69+
// The slug of the Sentry organization to use for uploading proguard mappings/source contexts.
70+
org = "___ORG_SLUG___"
71+
72+
// The slug of the Sentry project to use for uploading proguard mappings/source contexts.
73+
project = "___PROJECT_SLUG___"
74+
75+
// The authentication token to use for uploading proguard mappings/source contexts.
76+
// WARNING: Do not expose this token in your build.gradle files, but rather set an environment
77+
// variable and read it into this property.
78+
authToken = System.getenv("SENTRY_AUTH_TOKEN")
79+
80+
// The url of your Sentry instance. If you're using SAAS (not self hosting) you do not have to
81+
// set this. If you are self hosting you can set your URL here
82+
url = null
83+
5584
// Disables or enables the handling of Proguard mapping for Sentry.
5685
// If enabled the plugin will generate a UUID and will take care of
5786
// uploading the mapping to Sentry. If disabled, all the logic
@@ -93,6 +122,12 @@ sentry {
93122
// code as part of your stack traces in Sentry.
94123
includeSourceContext = false
95124
125+
// Configure additional directories to be included in the source bundle which is used for
126+
// source context. The directories should be specified relative to the Gradle module/project's
127+
// root. For example, if you have a custom source set alongside 'main', the parameter would be
128+
// 'src/custom/java'.
129+
additionalSourceDirsForSourceContext = []
130+
96131
// Enable or disable the tracing instrumentation.
97132
// Does auto instrumentation for specified features through bytecode manipulation.
98133
// Default is enabled.
@@ -146,6 +181,25 @@ sentry {
146181
import io.sentry.android.gradle.extensions.InstrumentationFeature
147182

148183
sentry {
184+
// Disables or enables debug log output, e.g. for for sentry-cli.
185+
// Default is disabled.
186+
debug.set(false)
187+
188+
// The slug of the Sentry organization to use for uploading proguard mappings/source contexts.
189+
org.set("___ORG_SLUG___")
190+
191+
// The slug of the Sentry project to use for uploading proguard mappings/source contexts.
192+
project.set("___PROJECT_SLUG___")
193+
194+
// The authentication token to use for uploading proguard mappings/source contexts.
195+
// WARNING: Do not expose this token in your build.gradle files, but rather set an environment
196+
// variable and read it into this property.
197+
authToken.set(System.getenv("SENTRY_AUTH_TOKEN"))
198+
199+
// The url of your Sentry instance. If you're using SAAS (not self hosting) you do not have to
200+
// set this. If you are self hosting you can set your URL here
201+
url = null
202+
149203
// Disables or enables the handling of Proguard mapping for Sentry.
150204
// If enabled the plugin will generate a UUID and will take care of
151205
// uploading the mapping to Sentry. If disabled, all the logic
@@ -186,6 +240,12 @@ sentry {
186240
// code as part of your stack traces in Sentry.
187241
includeSourceContext.set(false)
188242

243+
// Configure additional directories to be included in the source bundle which is used for
244+
// source context. The directories should be specified relative to the Gradle module/project's
245+
// root. For example, if you have a custom source set alongside 'main', the parameter would be
246+
// 'src/custom/java'.
247+
additionalSourceDirsForSourceContext.set(emptySet())
248+
189249
// Enable or disable the tracing instrumentation.
190250
// Does auto instrumentation for specified features through bytecode manipulation.
191251
// Default is enabled.
@@ -260,13 +320,11 @@ sentry {
260320

261321
## ProGuard/R8 & DexGuard
262322

263-
The plugin will automatically generate appropriate ProGuard mapping files and upload them when you run `gradle assemble{BuildVariant}`. For example, `assembleRelease`Release is the default, but the plugin works for others if you have enabled ProGuard/R8. The credentials for the upload step are loaded through environment variables or from a `sentry.properties` file in your project root.
323+
The plugin will automatically generate appropriate ProGuard mapping files and upload them when you run `gradle assemble{BuildVariant}`. For example, `assembleRelease`. Release is the default, but the plugin works for others as long as you've enabled ProGuard/R8. The credentials for the upload step are defined in the Gradle extension above or loaded from a `sentry.properties` file in your project.
264324

265-
If you are using the Guardsquare's ProGuard or DexGuard tooling, you have to enable the `experimentalGuardsquareSupport` flag.
325+
To use Guardsquare's ProGuard or DexGuard tooling, you'll have to enable the `experimentalGuardsquareSupport` flag. Learn more in the [full sentry-cli documentation](/product/cli/configuration/#configuration-values).
266326

267-
Learn more in the [full sentry-cli documentation](/product/cli/configuration/#configuration-values).
268-
269-
At the very minimum, you will need something similar to:
327+
Instead of providing your credentials via the Gradle extension, you can create a `sentry.properties` file with the following content under your `app` module:
270328

271329
<OrgAuthTokenNote />
272330

0 commit comments

Comments
 (0)