sentry-react-native: Production build is failing with RN 0.72 (Gradle 8)

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.6.0

react-native version: 0.72.0

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise? Configuration: Not relevant, this happens during build


I have following issue:

Starting with Gradle 8.0, task dependencies must be explicit.

Building a RN 0.72 app uses Gradle 8, which fails with:

…
> Task :app:bundleRelease
> Task :app:uploadSentryNativeSymbolsForRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':app:uploadSentryNativeSymbolsForRelease' (type 'SentryUploadNativeSymbolsTask').
  - Gradle detected a problem with the following location: '/Users/renchap/dev/notos/packages/mobile/android/app/build'.

    Reason: Task ':app:uploadSentryNativeSymbolsForRelease' uses this output of task ':app:produceReleaseBundleIdeListingFile' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':app:produceReleaseBundleIdeListingFile' as an input of ':app:uploadSentryNativeSymbolsForRelease'.
      2. Declare an explicit dependency on ':app:produceReleaseBundleIdeListingFile' from ':app:uploadSentryNativeSymbolsForRelease' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:produceReleaseBundleIdeListingFile' from ':app:uploadSentryNativeSymbolsForRelease' using Task#mustRunAfter.

    Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: '/Users/renchap/dev/notos/packages/mobile/android/app/build'.

    Reason: Task ':app:uploadSentryNativeSymbolsForRelease' uses this output of task ':app:createReleaseBundleListingFileRedirect' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':app:createReleaseBundleListingFileRedirect' as an input of ':app:uploadSentryNativeSymbolsForRelease'.
      2. Declare an explicit dependency on ':app:createReleaseBundleListingFileRedirect' from ':app:uploadSentryNativeSymbolsForRelease' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:createReleaseBundleListingFileRedirect' from ':app:uploadSentryNativeSymbolsForRelease' using Task#mustRunAfter.

    Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.

Steps to reproduce:

  • Run a production build (bundleRelease) with the Sentry SDK installed
  • See that Gradle fails the build due to missing tasks dependencies

Actual result:

The build fails with the error message above

Expected result:

The build succeed

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 17 (5 by maintainers)

Most upvoted comments

@devDanielCespedes Thank you one again for the example, the issue was the manually included @sentry_react_native project. You don’t have to do that, the react-native tooling includes our android project automatically and correctly assigns the tasks dependencies so the project builds with Gradle 8.

Please see the changes I’ve made, after this, the project build correctly.

https://github.com/devDanielCespedes/sentry-minimal-reproducible-example-error/compare/main...krystofwoldrich:sentry-minimal-reproducible-example-error:main

@humarkx @devDanielCespedes Thank you for the information, sadly we can’t reproduce the issue.

Could you provide a minimal reproducible example with detailed steps on how you build the app?

Hey, @krystofwoldrich how are you? I just managed to make a minimal reproducible example could you take a look, please? 😄

I followed Manual Configuration for the Android

Screencast from 05-07-2023 18:24:29.webm

@krystofwoldrich heads up that the docs still haven’t been updated to remove the manual inclusion of @sentry_react-native.

@devDanielCespedes Thank you for the reproducible example, I’ve reproduced it.

@krystofwoldrich https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/

I did the React Native Automatic installation, but doesn’t mention anywhere even on the manual docs, where to use that package. Maybe this should be somewhere in the RN install documentation: https://github.com/getsentry/sentry-react-native/blob/e44fe2d34ac8fb358e6660aa5df0109ee9982b56/sample-new-architecture/android/build.gradle

After updating to classpath("io.sentry:sentry-android-gradle-plugin:3.11.1") in android/build.gradle still causes the error

Thanks

@renchap still facing the same issue running 5.6.0 with the same configuration as above

@krystofwoldrich That worked for me as well. If those aren’t required anymore would it make sense to remove them from the manual configuration steps here? Or maybe tweak the docs to say to remove those lines.

https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#android

Woops, this was caused by the Sentry Android Gradle plugin, we used an old version that was not compatible with Gradle 8.

Updating it to the latest version worked fine.