Skip to content

sentry.gradle.kts unconditionally copies assets to the src/assets/main directory which breaks caching and up-to-date checks #6750

Description

@runningcode

There wasn't a field to describe what is wrong so I'm just adding it up here.

The sentry.gradle.kts script writes a file in to the src/main/assets without declaring inputs or outputs. This is problematic because this is a version controlled directory. This can also retrigger compilation since other gradle tasks will not know how that file got there.

What React Native libraries do you use?

RN New Architecture

Are you using sentry.io or on-premise?

sentry.io (SaS)

Are you using any other error monitoring solution alongside Sentry?

No

Other Error Monitoring Solution Name

No response

@sentry/react-native SDK Version

8.27.0

How does your development environment look like?

System:
  OS: macOS 26.6.2
  CPU: (14) arm64 Apple M4 Max
  Memory: 500.75 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 25.1.0
    path: /Users/no/.asdf/installs/nodejs/25.1.0/bin/node
  Yarn:
    version: 1.22.22
    path: /Users/no/.asdf/installs/nodejs/25.1.0/bin/yarn
  npm:
    version: 11.6.2
    path: /Users/no/.asdf/installs/nodejs/25.1.0/bin/npm
  Watchman:
    version: 2026.07.27.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/no/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.5
      - iOS 26.5
      - macOS 26.5
      - tvOS 26.5
      - visionOS 26.5
      - watchOS 26.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2026.1 AI-261.26222.65.2614.16204760
  Xcode:
    version: 26.6/17F113
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.16
    path: /Users/no/.asdf/shims/javac
  Ruby:
    version: 3.3.4
    path: /Users/no/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.2.0
    wanted: 20.2.0
  react:
    installed: 19.2.3
    wanted: 19.2.3
  react-native:
    installed: 0.87.0
    wanted: 0.87.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true


Sentry.init()

Sentry.init({
  dsn: 'https://...@sentry.io/...'
  // other options
});

Steps to Reproduce

npm run android

You can see that there is a task :app:copySentryJsonConfiguration run at the beginning of the build and then :app:cleanupTemporarySentryJsonConfiguration
I'm guessing the last task is to remove the file as we're generating straight in to a source controlled directory. However if the build fails then we're left with this file sitting there.

Expected Result

  1. The sentryjson file should be produced in to a build directory which isn't version controlled.
  2. We should use AGP's provided APIs for generating assets and register that directory:
    https://github.com/android/gradle-recipes/tree/agp-9.0/addGeneratedSourceFolder
  3. We should inherit from the Gradle Copy Task so that the inputs and outputs of the copy task are correctly declared.
  4. cleanupTemporarySentryJsonConfiguration becomes extraneous

Actual Result

Here's a build scan with the tasks running: https://scans.gradle.com/s/szed57rejsfwu/timeline#g6q6vh7b7a2cq

Feel free to ping me for any questions or help ;) I'm your local Gradle expert.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions