dotnet / dotnet/android

[.NET9] Changing app from net8-android to net9-android increased APK size by 70% (Same in .NET 10)

Open
#10,308 9 comments 0 reactions 0 assignees View on GitHub
need-attention
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 20h
Merged PRs (30d)
257

Description

### 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

```shell

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.