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

Unable to build with default generated project #42

Closed
colonelpopcorn opened this issue May 2, 2024 · 5 comments
Closed

Unable to build with default generated project #42

colonelpopcorn opened this issue May 2, 2024 · 5 comments

Comments

@colonelpopcorn
Copy link
Contributor

colonelpopcorn commented May 2, 2024

I'm getting a build error from the default capacitor.build.gradle script generated by npx cap sync. The build warns (Failed to resolve: io.opentelemetry:opentelemetry-bom:1.18.0) when I try to run Gradle sync with the generated plugins project, and errors when I try to build the app project. See this stack trace for the error:

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve io.opentelemetry:opentelemetry-bom:1.18.0.
     Required by:
         project :app > project :recognizebv-capacitor-plugin-msauth > com.microsoft.identity.client:msal:4.9.0
      > No matching variant of io.opentelemetry:opentelemetry-bom:1.18.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.3.1' but:
          - Variant 'apiElements' capability io.opentelemetry:opentelemetry-bom:1.18.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.3.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)
          - Variant 'enforcedApiElements' capability io.opentelemetry:opentelemetry-bom-derived-enforced-platform:1.18.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.3.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)
          - Variant 'enforcedRuntimeElements' capability io.opentelemetry:opentelemetry-bom-derived-enforced-platform:1.18.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.3.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)
          - Variant 'runtimeElements' capability io.opentelemetry:opentelemetry-bom:1.18.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.3.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)

Android Studio Version: Iguana | 2023.2.1
Java Version: corretto 17.0.10-amzn
Gradle Version: 8.6

@colonelpopcorn
Copy link
Contributor Author

colonelpopcorn commented May 2, 2024

I found this issue in M$oft's MSAL library here, and so I tried to exclude and re-include MSAL within the app build.gradle file. That didn't work (same error saying unable to resolve), and now I'm at a loss and wondering what can be done to resolve this issue. Here's how I've been trying to exclude the transitive dependency on MSAL:

  implementation(project(':capacitor-cordova-android-plugins')) {
    exclude(group: 'com.microsoft.identity.client', module: 'msal')
  }
  implementation "com.microsoft.identity.client:msal:5.3.0"

@colonelpopcorn
Copy link
Contributor Author

I was able to get this error resolved by bumping com.microsoft.identity.client:msal to 5.3.0 instead of 4.9.0. I can't confirm that this won't break anything for other users, but I experienced no issues. Is there any reason this version can't be changed upstream in this project? If there is concern about making the change do you have any suggestions for moving forward with this fix on our side? I'd prefer not to maintain a fork, even for a short length of time.

@colonelpopcorn
Copy link
Contributor Author

For those that need assistance with this issue you can use PR #43 as a patch with the patch-package npm package.

@joeydubs
Copy link

For those that need assistance with this issue you can use PR #43 as a patch with the patch-package npm package.

Appreciate this! Upgrading to this plugin from cordova-plugin-msal, and ran in to the same error. Found this issue, and was able to apply your fix to get it working. 😎

@wslaghekke
Copy link
Member

Fixed in version 3.5.2 and up

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

3 participants