auth0 / Guardian.Android

Android toolkit for Auth0 Guardian API
https://auth0.com/guardian
MIT License
5 stars 20 forks source link

The dependencie 'com.squareup.okhttp3:okhttp-bom:4.10.0' is crashing #116

Open MauricioMej opened 3 months ago

MauricioMej commented 3 months ago

Description

I'm trying to implement the SDK in react native CLI, but when is building, the dependencie okhttp3 crash the build.

implementation 'com.squareup.okhttp3:okhttp-bom:4.10.0'

Reproduction of issue

I import the SDK into react native

Sample:

  • Code sample:
    • I create a simple react native project
npx react-native init Example

And i import the Guardian SDK

  • Log files:
* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.squareup.okhttp3:okhttp-bom:4.10.0.
     Required by:
         project :app > com.auth0.android:guardian:0.8.0
      > No matching variant of com.squareup.okhttp3:okhttp-bom:4.10.0 was found. The consumer was configured to find a library for use during runtime, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.2.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - Variant 'apiElements' capability com.squareup.okhttp3:okhttp-bom:4.10.0:
              - Incompatible because this component declares a platform for use during compile-time and the consumer needed a library for use during runtime        
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.2.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'enforcedApiElements' capability com.squareup.okhttp3:okhttp-bom-derived-enforced-platform:4.10.0:
              - Incompatible because this component declares an enforced platform for use during compile-time and the consumer needed a library for use during runtime
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.2.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'enforcedRuntimeElements' capability com.squareup.okhttp3:okhttp-bom-derived-enforced-platform:4.10.0 declares a component for use during runtime:
              - Incompatible because this component declares an enforced platform and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.2.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'runtimeElements' capability com.squareup.okhttp3:okhttp-bom:4.10.0 declares a component for use during runtime:
              - Incompatible because this component declares a platform and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.2.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
  • Application settings:

build.gradle

dependencies {
      implementation("com.facebook.react:react-android")
      implementation 'com.auth0.android:guardian:0.8.0'

      if (hermesEnabled.toBoolean()) {
          implementation("com.facebook.react:hermes-android")
      } else {
          implementation jscFlavor
      }
  }

Environment

Please provide the following:

andy317fe301f8c7 commented 3 months ago

Hello, This may be an issue with your gradle configuration. I suggest either attempting to declare the dependency in your build.gradle and to ensure that your project has mavenCentral properly configured as a repository

LukaszK88 commented 3 months ago

@MauricioMej did you manage to resolve it?

MauricioMej commented 2 months ago

Not yet, I tried to import the dependency separately, but it still gives me an error.

LukaszK88 commented 2 months ago

version com.auth0.android:guardian:0.6.0 seems to work without this issue.

Bazni commented 2 months ago

I have the same problem as @MauricioMej, I may have found a solution but it would need to add a new dependency.

The bug has been present since version 0.7 of this package when okhttp-bom:4.10 has been added.

Is it possible to add implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0")) in the dependencies. 4.12 is the latest but I supposed 4.10 should be good

shaoyangdl commented 2 months ago

I have the same problem as @MauricioMej, I may have found a solution but it would need to add a new dependency.

The bug has been present since version 0.7 of this package when okhttp-bom:4.10 has been added.

Is it possible to add implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0")) in the dependencies. 4.12 is the latest but I supposed 4.10 should be good

I tried to add the dependency to every single module that using auth0, but still gets the issue

Bazni commented 2 months ago

Did you try to fork this package and replace implementation("com.squareup.okhttp3:okhttp-bom:4.10.0") by what I suggest? It's not working on my side either but it's the only thing I have in mind that could fix the issue.

Did you try to run your project with the same Gradle version as this package?