Repository navigation
Description
Android framework version
net11.0-android (Preview)
Affected platform version
.NET 11 SDK containing dotnet/sdk#55750
Description
Microsoft.Android.Sdk.NativeAOT.targets currently rewrites the .NET SDK's KnownRuntimePack metadata for Microsoft.NETCore.App NativeAOT packs. It pins LatestRuntimeFrameworkVersion and appends android-arm to RuntimePackRuntimeIdentifiers.
This was added as an Android-side workaround because the .NET SDK did not advertise android-arm for the NativeAOT runtime pack. dotnet/sdk#55750 adds that RID to the SDK's built-in KnownRuntimePack metadata.
Once dotnet/sdk#55750 is merged and available in the SDK used by this repository, remove the workaround from src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets:
<!-- Outer restores use RuntimeIdentifiers; RuntimeIdentifier is only set in per-RID inner builds. -->
<ItemGroup>
<_AndroidNetCoreAppNativeAotKnownRuntimePack Include="@(KnownRuntimePack->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('RuntimePackLabels', 'NativeAOT'))" />
<KnownRuntimePack Remove="@(_AndroidNetCoreAppNativeAotKnownRuntimePack)" />
<KnownRuntimePack Include="@(_AndroidNetCoreAppNativeAotKnownRuntimePack)">
<LatestRuntimeFrameworkVersion>$(MicrosoftNETCoreAppRefPackageVersion)</LatestRuntimeFrameworkVersion>
<RuntimePackRuntimeIdentifiers>%(RuntimePackRuntimeIdentifiers);android-arm</RuntimePackRuntimeIdentifiers>
</KnownRuntimePack>
</ItemGroup>Context: #12356 (comment)
Steps to Reproduce
- Wait for Add android-arm to NativeAOT runtime pack RIDs sdk#55750 to merge and flow into the .NET SDK consumed by dotnet/android.
- Remove the Android-side
KnownRuntimePackoverride above. - Restore a NativeAOT Android project with
RuntimeIdentifiers=android-arm. - Verify
project.assets.jsonselectsMicrosoft.NETCore.App.Runtime.NativeAOT.android-armand does not fall back toMicrosoft.NETCore.App.Runtime.NativeAOT.linux-bionic-arm.
Did you find any workaround?
Keep the existing Android-side override until the updated SDK is available.
Relevant log output
N/A
Activity
james-allison commentedon Aug 13, 2026
@jonathanpeppers I think there's an issue with this in Dotnet 11 - Preview 7. I've likely misunderstood something, but I had to change this property in Microsoft.Android.Sdk.BundledVersions.targets to avoid errors referencing what looks like it must be an internal build (11.0.0-preview.7.26378.119?).
I had been getting these errors:
That got my NativeAOT Android build further - but I'm still hitting issues that look like its not finding the NDK correctly.
akoeplinger commentedon Aug 13, 2026
Yeah you'll need to change the property to get the correct version. The error about NDK is something else, I think you'll need to collect a binlog to see why the NDK isn't found.
@jonathanpeppers I think this should also be using DotNetRuntimePacksVersion in
android/src/workloads/workloads.csproj
Lines 40 to 43 in d57b8c4
That said DotNetRuntimePacksVersion is already set to MicrosoftNETCoreAppRefPackageVersion but I'm not sure that's what you want since it'd mean you need to sync exactly to the version that is being released? or is that workloads.csproj just being used inside of the android repo for tests?
jonathanpeppers commentedon Aug 13, 2026
Our behavior also looked wrong here:
filipnavara commentedon Sep 10, 2026
dotnet/sdk#55750 was merged. Yet .NET 11 RC 1 still shipped with workload packs that reference non-existing package versions and thus make NativeAOT publish unusable.
Current workaround:
jonathanpeppers commentedon Sep 10, 2026
I don't think we could fix this until RC 2 code flow came in. But I think we can fix now, I'm checking on it.
[NativeAOT] Let the SDK select runtime packs (dotnet#12750)