Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MauricioMej opened this issue Aug 7, 2024 · 8 comments
Open

Comments

@MauricioMej
Copy link

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:

  • Version of this library used: Guardian 0.8.0
  • Version of the platform or framework used, if applicable: React Native 0.74.1
@andy317fe301f8c7
Copy link
Contributor

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
Copy link

@MauricioMej did you manage to resolve it?

@MauricioMej
Copy link
Author

MauricioMej commented Aug 30, 2024

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

@LukaszK88
Copy link

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

@Bazni
Copy link

Bazni commented Sep 16, 2024

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
Copy link

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
Copy link

Bazni commented Sep 17, 2024

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?

@rontho
Copy link

rontho commented Dec 20, 2024

That issue prevent from using the sdk since version 7. There is an open PR to fix this, is it possible to get it merged and released please? Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants