Version code doesn't handle all use cases in the gradle task
See original GitHub issueEnvironment
How do you use Sentry? Sentry SaaS (sentry.io)
Which SDK and version? @sentry/react-native@4.0.2
Steps to Reproduce
- Upgraded to latest version.
- Started the same CI process using
- Azure Devops
- Mobile App Tasks for iOS and Android
- Gradle@2
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:
- Created a year ago
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Thank you, @marandaneto and team! 👍