Skip to content

Improve XA0141 warning #9544

Description

@jpobst

.NET 9.0.100

The NuGet package information in the XA0141 warning seems helpful, but it doesn't appear to actually work.

Repro:

dotnet new android
dotnet add package Xamarin.GooglePlayServices.Vision.Face.Contour.Internal --version 116.1.0.19
dotnet build -c Release

results in:

warning XA0141: NuGet package '<unknown>' version '<unknown>' contains a shared library 'libface_detector_v2_jni.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details
warning XA0141: NuGet package '<unknown>' version '<unknown>' contains a shared library 'libface_detector_v2_jni.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details

We should:

  • Either fix the NuGet information to be more accurate or remove it.
  • Maybe add the arch information to the file name (arm64-v8a/libface_detector_v2_jni.so), as each package will likely contain many versions with the same file name.
  • Rewrite the warning to be a little less scary, emphasizing this is a future problem, not necessarily something that needs to be fixed today. ("is not correctly aligned" sounds like the library is broken today)

An updated example:

warning XA0141: NuGet package 'Xamarin.GooglePlayServices.Vision.Face.Contour.Internal' version '116.1.0.19' contains a shared library 'arm64-v8a/libface_detector_v2_jni.so' which is not 16KB aligned. Google may require 16KB aligned libraries in the future. See https://developer.android.com/guide/practices/page-sizes for more details.

Activity

  1. added this to the .NET 9 Servicing milestone on Nov 21, 2024
  2. grendello commented on Nov 22, 2024

    @grendello
    Contributor

    I think @dellis1972 looked into it sometime ago and determined that the information isn't available for transient packages. I'll see to adding arch information, but I can't do much about getting better nuget info. I'll leave that to @dellis1972 and @jonathanpeppers :)

  3. grendello commented on Nov 22, 2024

    @grendello
    Contributor

    Partial fix: #9547

  4. jonpryor commented on Nov 22, 2024

    @jonpryor
    Contributor

    This is going to require a fair bit of "plumbing" that I don't currently understand.

    Working backwards:

    • libface_detector_v2_jni.so comes from obj/Release/net9.0-android/lp/92/jl/jni/armeabi-v7a/libface_detector_v2_jni.so, obj/Release/net9.0-android/lp/76/jl/jni/armeabi-v7a/libface_detector_v2_jni.so
    • as per obj/Release/net9.0-android/lp/map.cache:
      • obj/Release/net9.0-android/lp/92 is from playservicesvisionfacecontourinternal-16.1.0.aar
      • obj/Release/net9.0-android/lp/76 is from play-services-vision-face-contour-internal.aar
    • Both playservicesvisionfacecontourinternal-16.1.0.aar and play-services-vision-face-contour-internal.aar are from @(XamarinBuildDownload) artifacts, e.g.
      11:04:44.957   1:7>Target "_XbdRestoreItems_playservicesvisionfacecontourinternal_16_1_0: (TargetId:147)" in file "$HOME/.nuget/packages/xamarin.googleplayservices.vision.face.contour.internal/116.1.0.19/buildTransitive/net8.0-android34.0/Xamarin.GooglePlayServices.Vision.Face.Contour.Internal.targets" from project "/Volumes/Xamarin-Work/tmp/gda-9544/gda-9544.csproj" (target "_XamarinBuildAddDownloadedItems" depends on it):
                         Added Item(s): 
                             XamarinBuildDownload=
                                 playservicesvisionfacecontourinternal-16.1.0
                                         Kind=Uncompressed
                                         Sha256=
                                         ToFile=playservicesvisionfacecontourinternal-16.1.0.aar
                                         Url=https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-vision-face-contour-internal/16.1.0/play-services-vision-face-contour-internal-16.1.0.aar
      
    • Ergo, play-services-vision-face-contour-internal-16.1.0.aar comes from the Xamarin.GooglePlayServices.Vision.Face.Contour.Internal NuGet package.

    How do we provide enough information/metadata/etc. for <BuildApk/>, when given obj/Release/net9.0-android/lp/92/jl/jni/armeabi-v7a/libface_detector_v2_jni.so, that it can "work backwards" and determine that it comes from the Xamarin.GooglePlayServices.Vision.Face.Contour.Internal NuGet package?

  5. grendello commented on Nov 22, 2024

    @grendello
    Contributor

    Nuget information can be propagated to the .so ITaskItem from the _ReferencePath item, which has all the nuget info.

  6. jonpryor commented on Dec 9, 2024

    @jonpryor
    Contributor

    See also: #9559

  7. locked and limited conversation to collaborators on Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions