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

Improve AndroidMavenLibrary dependency resolution error messaging #9706

Open
pjcollins opened this issue Jan 24, 2025 · 1 comment
Open

Improve AndroidMavenLibrary dependency resolution error messaging #9706

pjcollins opened this issue Jan 24, 2025 · 1 comment
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects.

Comments

@pjcollins
Copy link
Member

pjcollins commented Jan 24, 2025

Android framework version

net9.0-android

Affected platform version

.NET 9

Description

The AndroidMavenLibrary library and dependency resolution that happens in <MavenDownload/> can fail and produce less than ideal error messaging. It would be great if we could improve the logging to report which (if any) dependencies can be resolved, and which ones fail.

In the case of com.revenuecat.purchases:purchases-ui described below it seems that this library itself can be resolved, but somewhere along the way we encounter an error that is not actionable:

/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.24/tools/Xamarin.Android.Bindings.Maven.targets(28,5): error XA4237: Cannot download POM file for Maven artifact 'com.revenuecat.purchases:purchases-ui:8.11.0'. 
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.24/tools/Xamarin.Android.Bindings.Maven.targets(28,5): error XA4237: - Response status code does not indicate success: 404 (Not Found).

Steps to Reproduce

  1. dotnet new android
  2. Update the .csproj to include the following and build it:
<ItemGroup>
  <AndroidMavenLibrary Include="com.revenuecat.purchases:purchases-ui" Version="8.11.0" Bind="false" />
</ItemGroup>

Did you find any workaround?

I can work around this by setting the VerifyDependencies metadata to false, however this also suppresses messaging about the dependencies of this library:

<ItemGroup>
  <AndroidMavenLibrary Include="com.revenuecat.purchases:purchases-ui" Version="8.11.0" Bind="false" VerifyDependencies="false" />
</ItemGroup>
@pjcollins pjcollins added the needs-triage Issues that need to be assigned. label Jan 24, 2025
@jpobst
Copy link
Contributor

jpobst commented Jan 24, 2025

Yeah, the error message is definitely less than ideal. It is actually failing to download the POM for one of its dependencies:

https://repo1.maven.org/maven2/androidx/compose/compose-bom/2024.09.00/compose-bom-2024.09.00.pom

This is because this POM is from Google and not Maven Central:

https://dl.google.com/android/maven2/androidx/compose/compose-bom/2024.09.00/compose-bom-2024.09.00.pom

I think the way this should work is the POM should specify other repositories to check for dependencies, but this POM does not do this.

Additionally, I don't think we check that section today, so it wouldn't work even if the POM did specify the Google repository.

This error is occuring in the MavenDownload task. This may be the wrong place. It might should simply log a warning that it could not download a POM file, and then let the JavaDependencyVerification handle the rest. I think that would move the error to XA4247. There might be better logging coming from JavaDependencyVerification than MavenDownload.

Doing it this way would also allow a user to work around the issue by manually downloading the POM and adding it to their project as <AndroidAdditionalJavaManifest> if desired.

@jpobst jpobst added Area: App+Library Build Issues when building Library projects or Application projects. and removed needs-triage Issues that need to be assigned. labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: App+Library Build Issues when building Library projects or Application projects.
Projects
None yet
Development

No branches or pull requests

2 participants