sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Android sentry.gradle script does not work for release builds with gradle-play-publisher

Open Legion2 opened this issue 2 years ago • 14 comments

OS:

  • [ ] Windows
  • [ ] MacOS
  • [x] Linux

Platform:

  • [ ] iOS
  • [x] Android

SDK:

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

SDK version: 5.0.0

react-native version: 0.69.4

Are you using Expo?

  • [ ] Yes
  • [x] No

Are you using sentry.io or on-premise?

  • [x] sentry.io (SaaS)
  • [ ] on-premise

I have following issue:

Gradle release build fails with java.io.FileNotFoundException: .../available-version-codes.txt (No such file or directory),when using gradle-play-publisher plugin. The gradle-play-publisher plugin resolve the versionCode dynamically from the play store API. But when the sentry gradle script tries to read the versionCode an exception is thrown. According to a similar issue the sentry.gradle uses a legacy API to get the versionCode, which causes this error.

Steps to reproduce:

  • Setup android project
  • Setup gradle-play-publisher plugin to autoresolve version codes
play {
    // ...
    resolutionStrategy.set(ResolutionStrategy.IGNORE)
}
  • Add sentry.gradle script to gradle build script
  • Make a release build

Actual result:

Build fails with java.io.FileNotFoundException: .../available-version-codes.txt (No such file or directory) error message.

Expected result:

Build does not fail and upload source maps and android release app.

Legion2 avatar Mar 19 '23 18:03 Legion2

Thank you for the details and steps to reproduce, we will discuss internally if we will add support for gradle-play-publisher. Seems like we need to use a different API to get versionCode but, we need to be sure it doesn't break anything else.

krystofwoldrich avatar Mar 20 '23 10:03 krystofwoldrich

Let's fix the gradle script to not throw the exception, swallow and log it out, and look into adding support for the Play publisher in a different PR/issue. They can as of now init the SDK manually passing a custom release and dist if dynamically generated by a 3rd party tool.

marandaneto avatar Mar 24 '23 13:03 marandaneto

Created https://github.com/getsentry/sentry-react-native/issues/2924 for the feature request

marandaneto avatar Mar 24 '23 13:03 marandaneto

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Apr 15 '23 00:04 github-actions[bot]

Bump

Legion2 avatar Apr 15 '23 17:04 Legion2

Having same issue with KMP compose projects.

ishroid avatar May 30 '23 10:05 ishroid

@ishroid Could you share a bit more context? Are you using sentry-react-native and KMP in the same project? Or are you having the same issue with https://github.com/getsentry/sentry-kotlin-multiplatform?

krystofwoldrich avatar May 30 '23 13:05 krystofwoldrich

Sorry, looks like my comment out of context here, i am not using sentry-react-native my comment should be on gradle-play-publisher gitbut.

ishroid avatar May 30 '23 16:05 ishroid

Same issue here,

Rohphi avatar Jun 05 '23 05:06 Rohphi

Hasn't the situation changed? Do plugins still conflict?

arpkirill avatar May 25 '24 12:05 arpkirill

@arpkirill No changes yet, but thank you for the message, feel free to up vote the issue, this helps up prioritizing the task.

krystofwoldrich avatar May 27 '24 09:05 krystofwoldrich