getsentry / sentry-android-gradle-plugin

Gradle plugin for Sentry Android. Upload proguard, debug files, and more.
https://docs.sentry.io/platforms/android/gradle/
MIT License
142 stars 32 forks source link

KMP project fails to build when using Androidx Sqlite KMP #766

Open sproctor opened 2 weeks ago

sproctor commented 2 weeks ago

Gradle Version

8.10

AGP Version

8.5.2

Code Minifier/Optimizer

Proguard

Version

4.11.0

Sentry SDK Version

7.13.0

Steps to Reproduce

Include "androidx.sqlite:sqlite:2.5.0-alpha08" in dependencies.

Expected Result

Sentry should ignore the implementation on non-Android targets, or provide a JVM version of the Sentry sqlite dependency.

Actual Result

Execution failed for task ':desktopApp:run'.
> Could not resolve all files for configuration ':desktopApp:runtimeClasspath'.
   > Could not resolve io.sentry:sentry-android-sqlite:7.13.0.
     Required by:
         project :desktopApp > project :offline:database > androidx.room:room-runtime:2.7.0-alpha08 > androidx.room:room-runtime-jvm:2.7.0-alpha08 > androidx.sqlite:sqlite:2.5.0-alpha08
      > No matching variant of io.sentry:sentry-android-sqlite:7.13.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 17, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm', attribute 'ui' with value 'awt' but:
          - Variant 'releaseVariantReleaseApiPublication' declares a library, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, with the library elements 'aar' and the consumer needed a component for use during runtime, packaged as a jar
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 17)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
                  - Doesn't say anything about ui (required 'awt')
          - Variant 'releaseVariantReleaseRuntimePublication' declares a library for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, packaged as a jar
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 17)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
                  - Doesn't say anything about ui (required 'awt')

* Try:
> No matching variant errors are explained in more detail at https://docs.gradle.org/8.10/userguide/variant_model.html#sub:variant-no-match.
> Review the variant matching algorithm at https://docs.gradle.org/8.10/userguide/variant_attributes.html#sec:abm_algorithm.
> 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 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.10/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 46s
63 actionable tasks: 43 executed, 20 up-to-date
buenaflor commented 2 weeks ago

thx for the report, I'll have a look

romtsn commented 1 week ago

@sproctor thanks for reporting this! At the moment we don't support room-kmp, so the workaround for you would be to disable the auto-installation feature as follows:

sentry {
  autoInstallation.enabled.set(false)
}

We'll look into fixing this on our side, so we don't pull in our sqlite integration when there's a multiplatform room dependency.