Skip to content

[android] Could not find method exec() for arguments when build after upgrade to gradle 9.0.0 (using react-native 0.82.0-rc.4) #5192

@coder-xiaomo

Description

@coder-xiaomo

What React Native libraries do you use?

RN New Architecture, React Navigation

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

7.1.0

How does your development environment look like?

System:
  OS: Windows 11 10.0.26100
  CPU: (22) x64 Intel(R) Core(TM) Ultra 9 185H
  Memory: 3.31 GB / 31.61 GB
Binaries:
  Node:
    version: 22.17.0
    path: D:\Program\Development\Environment\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 11.6.0
    path: D:\Program\Development\Environment\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.14.36429.23 (Visual Studio Enterprise 2022)
Languages:
  Java: 22.0.2
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.1
    wanted: 19.1.1
  react-native:
    installed: 0.82.0-rc.4
    wanted: 0.82.0-rc.4
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Sentry.init()

Sentry.init({
  dsn: 'https://[email protected]/...',

  // Adds more context data to events (IP address, cookies, user, etc.)
  // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
  sendDefaultPii: true,

  // Configure Session Replay
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1,
  integrations: [Sentry.mobileReplayIntegration(), Sentry.feedbackIntegration()],

  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
  // spotlight: __DEV__,
});

Steps to Reproduce

  1. create an empty react-native 0.82.0-rc.4 project with gradle 9.0.0 (bare project, not using expo), and the project can successfully build
    distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
  2. then setup sentry (@sentry/react-native 7.1.0), the build failed
  3. downgrade to gradle 8.14.3 ,the project can successfully build now
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip

Expected Result

build success

Actual Result

build failed with this error: Could not find method exec() for arguments

> Task :sentry_react-native:bundleReleaseAar
> Task :sentry_react-native:mapReleaseSourceSetPaths
> Task :sentry_react-native:mergeReleaseResources
> Task :sentry_react-native:verifyReleaseResources
> Task :sentry_react-native:assembleRelease

> Task :app:createBundleReleaseJsAndAssets
info Bundle Debug ID: 41b4cd94-9ed6-4b02-9425-9cfec8a41606
LOG:Writing bundle output to: /home/runner/work/spidermemos-app/spidermemos-app/android/app/build/generated/assets/react/release/index.android.bundle
LOG:Writing sourcemap output to: /home/runner/work/spidermemos-app/spidermemos-app/android/app/build/intermediates/sourcemaps/react/release/index.android.bundle.packager.map
LOG:Done writing bundle output
LOG:Done writing sourcemap output
Copying 27 asset files
Done copying assets

> Task :app:createBundleReleaseJsAndAssets_SentryUpload_com.spidermemos.app@1.0.0.297-250923_031016-ad42e19+297_297 FAILED
> Task :app:createBundleReleaseJsAndAssets_SentryUploadCleanUp SKIPPED

gradle/actions: Writing build results to /home/runner/work/_temp/.gradle-actions/build-results/__run_19-1758568224965.json

[Incubating] Problems report is available at: file:///home/runner/work/spidermemos-app/spidermemos-app/android/build/reports/problems/problems-report.html
FAILURE: Build failed with an exception.


* Where:
Script '/home/runner/work/spidermemos-app/spidermemos-app/node_modules/@sentry/react-native/sentry.gradle' line: 127

* What went wrong:
Execution failed for task ':app:createBundleReleaseJsAndAssets_SentryUpload_com.spidermemos.app@1.0.0.297-250923_031016-ad42e19+297_297'.
> Could not find method exec() for arguments [sentry_7dlkgvu5je3odtm8aodv93hqa$_run_closure4$_closure9$_closure10$_closure16$_closure19$_closure21@4a963226] on task ':app:createBundleReleaseJsAndAssets_SentryUpload_com.spidermemos.app@1.0.0.297-250923_031016-ad42e19+297_297' of type org.gradle.api.DefaultTask.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to generate a Build Scan (Powered by Develocity).
> Get more help at https://help.gradle.org./

BUILD FAILED in 17m 22s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 10.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/9.0.0/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
972 actionable tasks: 834 executed, 138 from cache

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions