question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Version code doesn't handle all use cases in the gradle task

See original GitHub issue

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which SDK and version? @sentry/react-native@4.0.2

Steps to Reproduce

  1. Upgraded to latest version.
  2. Started the same CI process using

Expected Result

Successful build.

Actual Result

The build failed with this log:

FAILURE: Build failed with an exception.

* Where:
Script '/Users/runner/work/1/s/apps/gmap/node_modules/@sentry/react-native/sentry.gradle' line: 68

* What went wrong:
No signature of method: static java.lang.Math.abs() is applicable for argument types: (String) values: [347]
Possible solutions: abs(double), abs(float), abs(int), abs(long), any(), acos(double)

Temporary solution

As a temporary solution, I patched the package to remove the Math.abs usage:

diff --git a/node_modules/@sentry/react-native/sentry.gradle b/node_modules/@sentry/react-native/sentry.gradle
index dcdc3d4..f175698 100644
--- a/node_modules/@sentry/react-native/sentry.gradle
+++ b/node_modules/@sentry/react-native/sentry.gradle
@@ -65,12 +65,11 @@ gradle.projectsEvaluated {
           variant = currentVariant[0]
           releaseName = currentVariant[1]
           versionCode = currentVariant[2]
-          def absVersionCode = Math.abs(versionCode)
 
           // The Sentry server distinguishes source maps by release (`--release` in the command
           // below) and distribution identifier (`--dist` below).  Give the task a unique name
           // based on where we're uploading to.
-          def nameCliTask = "${bundleTask.name}_SentryUpload_${releaseName}_${absVersionCode}"
+          def nameCliTask = "${bundleTask.name}_SentryUpload_${releaseName}_${versionCode}"
 
           // If several outputs have the same releaseName and versionCode, we'd do the exact same
           // upload for each of them.  No need to repeat.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
marandanetocommented, Jul 4, 2022

The RN template uses Gradle 7.3.3 for RN 0.68.x https://github.com/facebook/react-native/blob/v0.68.2/template/android/gradle/wrapper/gradle-wrapper.properties and AGP 7.0.4 https://github.com/facebook/react-native/blob/v0.68.2/template/android/build.gradle#L25= Please try to upgrade it.

Otherwise, provide a minimal reproduction example, I can’t reproduce it on my end.

0reactions
SpreadTriadcommented, Jul 11, 2022

Thank you, @marandaneto and team! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solving common problems - Gradle User Manual
Currently Gradle only tracks on a per-task basis that no file encoding has been specified, but it does not track the system encoding...
Read more >
Handling versions which change over time
To refresh all dependencies in the dependency cache, use the --refresh-dependencies option on the command line. The --refresh-dependencies option tells Gradle ...
Read more >
Build Script Basics - Gradle User Manual
This chapter introduces you to the basics of writing Gradle build scripts. It uses toy examples to explain basic functionality of Gradle, which...
Read more >
Sharing dependency versions between projects
A version catalog provides a number of advantages over declaring the dependencies directly in build scripts: For each catalog, Gradle generates type-safe ...
Read more >
Authoring Tasks - Gradle User Manual
You often need to locate the tasks that you have defined in the build file, for example, to configure them or use them...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found