sentry-dart icon indicating copy to clipboard operation
sentry-dart copied to clipboard

Circular dependency error in the Android Gradle Plugin

Open feinstein opened this issue 1 year ago • 6 comments

Platform

Dart

Obfuscation

Enabled

Debug Info

Enabled

Doctor

[✓] Flutter (Channel stable, 3.22.3, on macOS 14.5 23F79 darwin-arm64, locale en-AU) • Flutter version 3.22.3 on channel stable at /Users/user/.puro/envs/stable/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision b0850beeb2 (3 weeks ago), 2024-07-16 21:43:41 -0700 • Engine revision 235db911ba • Dart version 3.4.4 • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/user/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/user/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15F31d • CocoaPods version 1.15.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Community Edition (version 2024.1.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 79.0.3 • Dart plugin version 241.15989.9

[✓] VS Code (version 1.91.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.88.0

[✓] Connected device (5 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator) • iPhone 15 Pro (mobile) • D18F35A4-68A7-4B23-8353-9D087BE9AEDB • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.5 23F79 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.99 ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources • All expected network resources are available.

• No issues found!

Version

8.5.0

Steps to Reproduce

Configure this in your pubspec.yaml:

dependencies:
  sentry_dio: ^8.5.0
  sentry_flutter: 8.5.0
  sentry_logging: 8.5.0

dev_dependencies:
  sentry_dart_plugin: ^2.1.0

sentry:
  project: my_project
  org: my_org
  ignore_missing: true

Then this in your android/app/build.gradle:

plugins {
//...
  id "io.sentry.android.gradle" version "4.10.0"
}

import io.sentry.android.gradle.extensions.InstrumentationFeature
import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel

entry {
    uploadNativeSymbols = true
    autoUploadNativeSymbols = true
    includeNativeSources = false
    includeSourceContext = false
    tracingInstrumentation {
        enabled = true
        features = [InstrumentationFeature.DATABASE, InstrumentationFeature.FILE_IO, InstrumentationFeature.OKHTTP, InstrumentationFeature.COMPOSE]
        logcat {
            enabled = true
            minLevel = LogcatLevel.WARNING
        }
    }

    autoInstallation {
        enabled = true
    }

    ignoredBuildTypes = ["debug"]
    ignoredFlavors = ["development", "staging"]
}

Then try to make a release build with Flutter using this command:

flutter build $ARTIFACT_TYPE \
          --build-number=1 \
          --target lib/main.dart \
          --flavor production \
          --obfuscate --split-debug-info=your/obfuscation/dir/symbols \
          --extra-gen-snapshot-options=--save-obfuscation-map=your/obfuscation/dir/obfuscation_map.json \
          --dart-define=SENTRY_ENVIRONMENT=production

And you should see this error:

Running Gradle task 'bundleProductionRelease'...                
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply


FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between the following tasks:
:app:compileProductionReleaseJavaWithJavac
+--- :app:compileProductionReleaseKotlin
|    \--- :app:processProductionReleaseResources
|         \--- :app:copyFlutterAssetsProductionRelease
|              \--- :app:mergeProductionReleaseAssets
|                   \--- :app:generateSentryDebugMetaPropertiesProductionRelease
|                        \--- :app:generateSentryProguardUuidProductionRelease
|                             \--- :app:minifyProductionReleaseWithR8
|                                  +--- :app:mergeProductionReleaseGeneratedProguardFiles
|                                  |    +--- :app:compileProductionReleaseJavaWithJavac (*)
|                                  |    +--- :app:compileProductionReleaseKotlin (*)
|                                  |    \--- :app:processProductionReleaseResources (*)
|                                  +--- :app:mergeProductionReleaseJavaResource
|                                  |    \--- :app:compileProductionReleaseKotlin (*)
|                                  +--- :app:processProductionReleaseResources (*)
|                                  \--- :app:transformProductionReleaseClassesWithAsm
|                                       +--- :app:compileProductionReleaseJavaWithJavac (*)
|                                       +--- :app:compileProductionReleaseKotlin (*)
|                                       \--- :app:processProductionReleaseResources (*)
\--- :app:processProductionReleaseResources (*)

(*) - 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

BUILD FAILED in 1m 41s
Running Gradle task 'bundleProductionRelease'...                  101.5s
Gradle task bundleProductionRelease failed with exit code 1


Build failed :|
Step 13 script `Build App` exited with status code 1

If I downgrade the gradle plugin version to 4.2.0 I don't get any errors, but this doesn't allow me to get the latest updates.

I see there's a related issue in the react native lib: https://github.com/getsentry/sentry-react-native/issues/3644

Expected Result

Not getting a build error.

Actual Result

Getting the error above.

Are you willing to submit a PR?

None

feinstein avatar Aug 08 '24 01:08 feinstein