Skip to content

Improve AndroidMavenLibrary dependency resolution error messagingΒ #9706

Closed

Description

@pjcollins

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>

Activity

  1. added
    needs-triage
    on Jan 24, 2025
  2. jpobst commented on Jan 24, 2025

    @jpobst
    Contributor

    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.

  3. added
    Area: App+Library Build
    and removed
    needs-triage
    on Jan 24, 2025
  4. added this to the .NET 10 milestone on Jan 30, 2025
  5. stricklandconsulting commented on May 6, 2025

    @stricklandconsulting

    @jpobst Is it possible to use AndroidAdditionalJavaManifest to specify a locally downloaded POM at this point, or is that only with .Net 10?

    We're getting the same issue with com.google.firebase:firebase-pom's resolution. We use a custom repo for distributing our own Maven libraries, but when it hits dependency resolution, it's failing on that one. I've contemplated either making a FAT AAR of it, but that's not optimal, or manually pulling all the files needed and uploading them to our maven repo, but that also doesn't make sense for us to do, with it up on Google's repo.

  6. jpobst commented on May 6, 2025

    @jpobst
    Contributor

    <AndroidAdditionalJavaManifest> was added in .NET 9. Another option would be to use <AndroidIgnoredJavaDependency>.

  7. added a commit that references this issue on Aug 11, 2026
    7776e47
  8. locked and limited conversation to collaborators on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library Build

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions