Skip to content

APK size increase using Preview 3 #11204

@gmck

Description

@gmck

Android framework version

net11.0-android (Preview)

Affected platform version

VS2026 Insiders Insiders [11716.218]

Description

I’ve created a new repo for Preview3 based on my net10-android36.1 production repo and have built for both net11.0-android36.1 and net11.0-android37 (against the Android17 QPR1 Beta1 CP31.260403.005.A1 on a Pixel6). The only difference between the builds is <EnablePreviewFeatures>true</EnablePreviewFeatures> for android37 and
< EnablePreviewFeatures> false </EnablePreviewFeatures> for android36.1.

The Net11 builds contain the latest NuGet packages as compared to the NET10 production build. However, I can’t upgrade them further due to dotnet/android-libraries#1401. So, I’m guessing they are at least a couple of weeks old.

The apk sizes are -
net10.0-android36.1 21,727 kb
net11.0-android36.1 33,841 kb
net11.0-android37 33,845 kb

So, an approximate difference of 12kb. Can you explain/suggest how I can reduce both Net11 APK sizes?
The only difference between the net10-android36.1 production build and both the Net11 builds is that the NuGet’s in the production build can’t handle any further NuGet updates because of issue #10700, which certainly looks to be fixed with Net11. Could you please supply a timeline for when that fix will be backported to Net10?

The other thing that is strange is the build output for the Net11 preview; it is only 10 lines long, even though it is set to Diagnostics. All it really contains are a couple of warnings, CA1416 and IL6001, which I will need to address.

Steps to Reproduce

N/A

Did you find any workaround?

N/A

Relevant log output

1>C:\Program Files\dotnet\sdk\11.0.100-preview.3.26207.106\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(383,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
1>C:\Projects - VS2026\Net11Preview\OBDNowProsNet11Prev3\Preferences\ElmAdaptiveTimingPreferenceDialogFragmentCompat.cs(47,17,47,51): warning CA1416: This call site is reachable on: 'Android' 27.0 and later. 'ListView.Adapter.set' is unsupported on: 'android' 15.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>C:\Projects - VS2026\Net11Preview\OBDNowProsNet11Prev3\Preferences\ElmTimeoutPreferenceDialogFragmentCompat.cs(70,17,70,44): warning CA1416: This call site is reachable on: 'Android' 27.0 and later. 'ListView.Adapter.set' is unsupported on: 'android' 15.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
1>  OBDNowPros -> C:\Projects - VS2026\Net11Preview\OBDNowProsNet11Prev3\bin\Release\net11.0-android36.1\OBDNowPros.dll
1>  Optimizing assemblies for size. This process might take a while.
1>C:\Users\gmcke\.nuget\packages\newtonsoft.json\13.0.3\lib\net6.0\Newtonsoft.Json.dll : warning IL2104: Assembly 'Newtonsoft.Json' produced trim warnings. For more information see https://aka.ms/il2104
1>C:\Users\gmcke\.nuget\packages\oxyplot.core\1.0.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1+Xamarin.iOS10\OxyPlot.dll : warning IL2104: Assembly 'OxyPlot' produced trim warnings. For more information see https://aka.ms/il2104
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\36.99.0-preview.3.10\targets\Microsoft.Android.Sdk.AssemblyResolution.targets(242,5): warning IL6001: Assembly 'OBDNowPros' contains reference to obsolete attribute 'Android.Runtime.PreserveAttribute'. Members with this attribute may be trimmed. Please use System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute instead
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild completed at 3:28 PM and took 01:43.402 minutes ==========

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.needs-triageIssues that need to be assigned.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions