You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Xamarin.Android.Build.Tasks] Add %(NuGetPackage*) to TaskItems (#9559)
Fixes: #9544
Context: 64bb147
[Google announced][0] that future versions of Android would require
that native libraries use 16 KB page sizes on arm64. At present, the
timeline for *when* 16 KB page sizes will be required is unknown,
though we assume it will be with Android 16 or later.
In order to get ahead of this, .NET 9 added an XA0141 warning in
64bb147.
The problem is, this warning is not entirely actionable:
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
What are customers supposed to *do* with this?
The original assumption was that the NuGet package and Version would
be available as metadata items on the MSBuild Items. Unfortunately
that was not the case, so the data the user gets is empty.
Add the required metadata to all NuGet Package references resolved by
the project. This will allow us to propagate that data throughout
the build Items as they are transformed. This means we can provide a
decent error message to the user:
warning XA0141: Android 16 will require 16 KB page sizes, shared library 'libface_detector_v2_jni.so' does not have a 16 KB page size.
Please inform the authors of the NuGet package 'Xamarin.GooglePlayServices.Vision.Face.Contour.Internal' version '116.1.0.19'
which contains 'lib/net8.0-android34.0/play-services-vision-face-contour-internal.aar'.
See https://developer.android.com/guide/practices/page-sizes for more details.
[0]: https://android-developers.googleblog.com/2024/08/adding-16-kb-page-size-to-android.html
NuGet package '{0}' version '{1}' contains a shared library '{2}' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details
10
+
Future versions of Android on arm64 will require that native libraries use 16 KB page sizes.
11
+
This requires that the mentioned native libraries be recompiled, and all apps using those
12
+
native libraries be rebuilt to contain the fixed versions of the native libraries.
13
+
14
+
See the Android SDK [Support 16 KB page sizes](https://developer.android.com/guide/practices/page-sizes)
15
+
documentation for more information.
11
16
12
17
## Solution
13
18
14
-
The indicated native shared library must be recompiled and relinked with the 16k alignment, as per URL indicated in the message.
19
+
The indicated native shared library must be recompiled and relinked with the 16k alignment, as per
20
+
the Android SDK [Support 16 KB page sizes](https://developer.android.com/guide/practices/page-sizes)
21
+
documentation.
22
+
23
+
## Example messages
24
+
25
+
> warning XA0141: Android 16 will require 16 KB page sizes, Shared library 'libface_detector_v2_jni.so' does not have a 16 KB page size.
26
+
> Please inform the authors of the NuGet package 'Xamarin.GooglePlayServices.Vision.Face.Contour.Internal' version '116.1.0.19'
27
+
> which contains 'lib/net8.0-android34.0/play-services-vision-face-contour-internal.aar'.
28
+
> See https://developer.android.com/guide/practices/page-sizes for more details.
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AndroidLibraries.targets
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1072,11 +1072,12 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS
1072
1072
{1} - NuGet package version</comment>
1073
1073
</data>
1074
1074
<dataname="XA0141"xml:space="preserve">
1075
-
<value>NuGet package '{0}' version '{1}' contains a shared library '{2}' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details</value>
1075
+
<value>Android 16 will require 16 KB page sizes, shared library '{3}' does not have a 16 KB page size. Please inform the authors of the NuGet package '{0}' version '{1}' which contains '{2}'. See https://developer.android.com/guide/practices/page-sizes for more details.</value>
1076
1076
<comment>The following is a literal name and should not be translated: NuGet
0 commit comments