Skip to content

[.NET9] Changing app from net8-android to net9-android increased APK size by 70% #10308

@projectgoav

Description

@projectgoav

Android framework version

net9.0-android

Affected platform version

Visual Studio 2022

Description

I have changed our app from targetting net8-android to net9-android as the Google PlayStore now requires us to target Android 15. By doing this our APK has increased by around 70% with no code changes.

Applying code changes to handle Edge-To-Edge displays adds roughly 100KB to the APK size, which is around what I'd expect.

Why has .NET9 caused such a massive increase in APK size? This has cause our builds times to really slow down.

.NET 8 App: 51,559KB
.NET 9 App: 87,666KB (36,107KB increase, ~ 70%)

Looking at the generated APK there are a couple of areas where this has massively increased:

  1. the lib/ folder
  2. [something]/Main] folders now present.

See screenshot:

Image

lib/ Folder

For each of the target archictures there appears to be a new libassembles[target].blob.so present. This is roughly 2x the size of all other artifacts in that directory.

Image Image

[something]/Main/ Folders

The root of our APK is stuffed full of new folders. They appear to for different targets such as "Web" and "JS/WASM" neither of which we use.

Image

Steps to Reproduce

  1. Change the TargetFrameworkVersion from net8-android to net9-android
  2. Build

Did you find any workaround?

No

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    need-attentionA xamarin-android contributor needs to review

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions