getsentry / sentry-react-native

Official Sentry SDK for React-Native
https://sentry.io
MIT License
1.55k stars 325 forks source link

Circular dependency between compileReleaseJavaWithJavac and generateSentryProguardUuidRelease #3644

Open abdullRahman95 opened 4 months ago

abdullRahman95 commented 4 months ago

OS:

Platform:

SDK:

SDK version: 5.17.0

react-native version: 0.67.5

Are you using Expo?

Are you using sentry.io or on-premise?

If you are using sentry.io, please post a link to your issue so we can take a look:

[Link to issue]

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://...@sentry.io/...'
  // other options
});

I have the following issue:

When I upgraded "@sentry/react-native" from 5.13.0 to 5.17.0, and was trying to create a release build for android (react-native), I'm getting the following error:

2024-02-29T06:45:09.3477590Z * What went wrong:
2024-02-29T06:45:09.3478140Z Circular dependency between the following tasks:
2024-02-29T06:45:09.3478700Z :app:compileReleaseJavaWithJavac
2024-02-29T06:45:09.3479500Z +--- :app:compileReleaseKotlin
2024-02-29T06:45:09.3480220Z |    +--- :app:dataBindingGenBaseClassesRelease
2024-02-29T06:45:09.3482330Z |    |    \--- :app:mergeReleaseResources
2024-02-29T06:45:09.3483210Z |    |         \--- :app:copyReleaseBundledJs
2024-02-29T06:45:09.3487450Z |    |              \--- :app:mergeReleaseAssets
2024-02-29T06:45:09.3492570Z |    |                   \--- :app:generateSentryDebugMetaPropertiesRelease
2024-02-29T06:45:09.3497810Z |    |                        \--- :app:generateSentryProguardUuidRelease
2024-02-29T06:45:09.3498770Z |    |                             \--- :app:minifyReleaseWithR8
2024-02-29T06:45:09.3499570Z |    |                                  +--- :app:mergeReleaseGeneratedProguardFiles
2024-02-29T06:45:09.3500360Z |    |                                  |    +--- :app:compileReleaseJavaWithJavac (*)
2024-02-29T06:45:09.3501380Z |    |                                  |    +--- :app:compileReleaseKotlin (*)
2024-02-29T06:45:09.3502170Z |    |                                  |    \--- :app:processReleaseResources
2024-02-29T06:45:09.3504020Z |    |                                  |         \--- :app:mergeReleaseResources (*)
2024-02-29T06:45:09.3505840Z |    |                                  +--- :app:mergeReleaseJavaResource
2024-02-29T06:45:09.3506650Z |    |                                  |    \--- :app:compileReleaseKotlin (*)
2024-02-29T06:45:09.3509170Z |    |                                  +--- :app:processReleaseResources (*)
2024-02-29T06:45:09.3509980Z |    |                                  \--- :app:transformReleaseClassesWithAsm
2024-02-29T06:45:09.3511070Z |    |                                       +--- :app:compileReleaseJavaWithJavac (*)
2024-02-29T06:45:09.3511900Z |    |                                       +--- :app:compileReleaseKotlin (*)
2024-02-29T06:45:09.3512800Z |    |                                       \--- :app:processReleaseResources (*)
2024-02-29T06:45:09.3519560Z |    \--- :app:processReleaseResources (*)
2024-02-29T06:45:09.3520290Z +--- :app:dataBindingGenBaseClassesRelease (*)
2024-02-29T06:45:09.3521790Z \--- :app:processReleaseResources (*)

I tried to update sentryGradlePluginVersion in android\build.gradle file to 4.3.1 as specified in the documentation (https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#android, https://mvnrepository.com/artifact/io.sentry/sentry-android-gradle-plugin) but no luck, could you please help on this?

krystofwoldrich commented 4 months ago

Hi @abdullRahman95, thank you for the message, can you try to upgrade to the latest https://github.com/getsentry/sentry-react-native/releases/tag/5.19.1 with the Sentry Android Plugin 4.3.1 and let us know if the issue still occurs?

abdullRahman95 commented 4 months ago

Hi @krystofwoldrich Thank you for checking this issue, I have upgraded @sentry/react-native to 5.19.1 with Android Plugin 4.3.1, and same issue still happening with the following error:


FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between the following tasks:
:app:compileReleaseJavaWithJavac
+--- :app:compileReleaseKotlin
|    +--- :app:dataBindingGenBaseClassesRelease
|    |    \--- :app:mergeReleaseResources
|    |         \--- :app:copyReleaseBundledJs
|    |              \--- :app:mergeReleaseAssets
|    |                   \--- :app:generateSentryDebugMetaPropertiesRelease
|    |                        \--- :app:generateSentryProguardUuidRelease
|    |                             \--- :app:minifyReleaseWithR8
|    |                                  +--- :app:mergeReleaseGeneratedProguardFiles
|    |                                  |    +--- :app:compileReleaseJavaWithJavac (*)
|    |                                  |    +--- :app:compileReleaseKotlin (*)
|    |                                  |    \--- :app:processReleaseResources
|    |                                  |         \--- :app:mergeReleaseResources (*)
|    |                                  +--- :app:mergeReleaseJavaResource
|    |                                  |    \--- :app:compileReleaseKotlin (*)
|    |                                  +--- :app:processReleaseResources (*)
|    |                                  \--- :app:transformReleaseClassesWithAsm
|    |                                       +--- :app:compileReleaseJavaWithJavac (*)
|    |                                       +--- :app:compileReleaseKotlin (*)
|    |                                       \--- :app:processReleaseResources (*)
|    \--- :app:processReleaseResources (*)
+--- :app:dataBindingGenBaseClassesRelease (*)
\--- :app:processReleaseResources (*)

(*) - details omitted (listed previously)

* 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 get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

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

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 10s
Ch4rl3B commented 4 months ago

I´m having the same error with the sentry-android-gradle-plugin in Flutter

krystofwoldrich commented 4 months ago

Thank you for the update @Ch4rl3B and @abdullRahman95,

we are currently unable to reproduce this,

would you be able to share a minimal reproducible example?

Can you also share your Sentry Android Gradle Plugin configuration?

krystofwoldrich commented 4 months ago

@markushi @romtsn Do you have any tips on how to debug this?

markushi commented 3 months ago

I started looking into this and so far couldn't reproduce this issue. @Ch4rl3B @abdullRahman95 could you share some more details about your build environment?

Karjan1 commented 3 months ago

Hi I have the same issue with sentry-android-gradle-plugin. Maybe my context would be helpful

krystofwoldrich commented 3 months ago

@Karjan1 Thank you, we'll keep you posted.

markushi commented 3 months ago

Hey @Karjan1, we just released io.sentry.android.gradle:4.4.0 which contains a fix to a very similar issue. Could you give it a try?

Karjan1 commented 3 months ago

No still getting the same error. One thing that I found surprising is flutter build appbundle --release gives that error but flutter build appbundle --debug works fine

daniel-johns-99 commented 3 months ago

Hi @Karjan1 - We are still facing the same problem with same stack trace with AGP 4.4.0

2024-03-27T05:55:14.1937370Z FAILURE: Build failed with an exception.
2024-03-27T05:55:14.1938000Z 
2024-03-27T05:55:14.1938710Z * What went wrong:
2024-03-27T05:55:14.1939320Z Circular dependency between the following tasks:
2024-03-27T05:55:14.1939980Z :app:compileReleaseJavaWithJavac
2024-03-27T05:55:14.1941120Z +--- :app:compileReleaseKotlin
2024-03-27T05:55:14.1941970Z |    +--- :app:dataBindingGenBaseClassesRelease
2024-03-27T05:55:14.1942750Z |    |    \--- :app:mergeReleaseResources
2024-03-27T05:55:14.1985040Z |    |         \--- :app:copyReleaseBundledJs
2024-03-27T05:55:14.1999580Z |    |              \--- :app:mergeReleaseAssets
2024-03-27T05:55:14.2000520Z |    |                   \--- :app:generateSentryDebugMetaPropertiesRelease
2024-03-27T05:55:14.2000970Z |    |                        \--- :app:generateSentryProguardUuidRelease
2024-03-27T05:55:14.2001380Z |    |                             \--- :app:minifyReleaseWithR8
2024-03-27T05:55:14.2001840Z |    |                                  +--- :app:mergeReleaseGeneratedProguardFiles
2024-03-27T05:55:14.2002300Z |    |                                  |    +--- :app:compileReleaseJavaWithJavac (*)
2024-03-27T05:55:14.2002720Z |    |                                  |    +--- :app:compileReleaseKotlin (*)
2024-03-27T05:55:14.2003130Z |    |                                  |    \--- :app:processReleaseResources
2024-03-27T05:55:14.2003530Z |    |                                  |         \--- :app:mergeReleaseResources (*)
2024-03-27T05:55:14.2004100Z |    |                                  +--- :app:mergeReleaseJavaResource
2024-03-27T05:55:14.2004510Z |    |                                  |    \--- :app:compileReleaseKotlin (*)
2024-03-27T05:55:14.2004950Z |    |                                  +--- :app:processReleaseResources (*)
2024-03-27T05:55:14.2005370Z |    |                                  \--- :app:transformReleaseClassesWithAsm
2024-03-27T05:55:14.2005790Z |    |                                       +--- :app:compileReleaseJavaWithJavac (*)
2024-03-27T05:55:14.2006210Z |    |                                       +--- :app:compileReleaseKotlin (*)
2024-03-27T05:55:14.2006610Z |    |                                       \--- :app:processReleaseResources (*)
2024-03-27T05:55:14.2006920Z |    \--- :app:processReleaseResources (*)
2024-03-27T05:55:14.2007290Z +--- :app:dataBindingGenBaseClassesRelease (*)
2024-03-27T05:55:14.2008740Z \--- :app:processReleaseResources (*)
2024-03-27T05:55:14.2008840Z 
2024-03-27T05:55:14.2010280Z (*) - details omitted (listed previously)
Karjan1 commented 3 months ago

I gave other versions a try. io.sentry.android.gradle:4.2.0 is the last version that works. Both 4.3.0 and 4.4.0 give the same error

markushi commented 3 months ago

Quick update: I was finally able to locally reproduce this issue, at least for flutter. But it looks like the same issue we have on RN, namely the mergeReleaseAssets tasks being rewired by Flutter/RN which then causes our Sentry Android Gradle plugin to fail.

Circular dependency between the following tasks:
:app:compileReleaseJavaWithJavac
+--- :app:compileReleaseKotlin
|    \--- :app:processReleaseResources
|         \--- :app:copyFlutterAssetsRelease
|              \--- :app:mergeReleaseAssets
|                   \--- :app:generateSentryDebugMetaPropertiesRelease
|                        \--- :app:generateSentryProguardUuidRelease
|                             \--- :app:minifyReleaseWithR8
|                                  +--- :app:mergeReleaseGeneratedProguardFiles
|                                  |    +--- :app:compileReleaseJavaWithJavac (*)
|                                  |    +--- :app:compileReleaseKotlin (*)
|                                  |    \--- :app:processReleaseResources (*)
|                                  +--- :app:mergeReleaseJavaResource
|                                  |    \--- :app:compileReleaseKotlin (*)
|                                  +--- :app:processReleaseResources (*)
|                                  \--- :app:transformReleaseClassesWithAsm
|                                       +--- :app:compileReleaseJavaWithJavac (*)
|                                       +--- :app:compileReleaseKotlin (*)
|                                       \--- :app:processReleaseResources (*)
\--- :app:processReleaseResources (*)

I'll keep you posted about any updates!

markushi commented 2 months ago

@Karjan1 we shipped a fix for this in io.sentry.android.gradle:4.4.1, would you mind giving it a try?

subramani48 commented 2 months ago

Circular dependency between the following tasks: :app:processReleaseResources --- :app:processReleaseResources (*)

How to resolve this

Lucienzera commented 1 month ago

I started looking into this and so far couldn't reproduce this issue. @Ch4rl3B @abdullRahman95 could you share some more details about your build environment?

  • AGP version
  • Gradle version
  • Are you using DexGuard?

Hey, how do you enable dexguardEnabled flag for expo/sentry-react-native?

ys-sherzad commented 1 month ago

@markushi I'm facing a similar problem following the documentation, once I reach this point: https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp and that's applying the plugin

apply plugin: "io.sentry.android.gradle"

I start getting a circular dependency when building a release app

:app:compileStagingReleaseJavaWithJavac
\--- :app:processStagingReleaseResources
     +--- :app:mapStagingReleaseSourceSetPaths
     |    \--- :app:mergeStagingReleaseResources
     |         \--- :app:copyStagingReleaseBundledJs
     |              \--- :app:mergeStagingReleaseAssets
     |                   \--- :app:generateSentryDebugMetaPropertiesStagingRelease
     |                        \--- :app:generateSentryProguardUuidStagingRelease
     |                             \--- :app:minifyStagingReleaseWithR8
     |                                  +--- :app:mergeStagingReleaseGeneratedProguardFiles
     |                                  |    +--- :app:compileStagingReleaseJavaWithJavac (*)
     |                                  |    \--- :app:processStagingReleaseResources (*)
     |                                  +--- :app:processStagingReleaseResources (*)
     |                                  \--- :app:transformStagingReleaseClassesWithAsm
     |                                       +--- :app:compileStagingReleaseJavaWithJavac (*)
     |                                       \--- :app:processStagingReleaseResources (*)
     \--- :app:mergeStagingReleaseResources (*)

"@sentry/react-native": "^5.22.2"

UPDATE I got it to build by downgrading the plugin in android/build.gradle from 4.6.0 to 4.2.0

dependencies {
     classpath 'io.sentry:sentry-android-gradle-plugin:4.2.0'
}
krystofwoldrich commented 1 month ago

Thank you everyone for the comment, we are reopening the issue and will investigate it.