dotnet / dotnet/android

Use `--output-pinvokes` feature to remove extra `.so` files from apps

Open
#7,114 0 comments 0 reactions 1 assignee Assigned to @jonathanpeppers View on GitHub
Area: App+Library Build enhancement
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 19h
Merged PRs (30d)
252

Description

### Android application type

Android for .NET (net6.0-android, etc.)

### Affected platform version

.NET 6+

### Description

Context: https://github.com/dotnet/linker/issues/2853#issuecomment-1160801078

If you `dotnet new android` and then build with `-c Release`, you get an `.apk` with a couple extra native libraries:

![image](https://user-images.githubusercontent.com/840039/174869632-901c55a3-a9a9-47c3-821d-65bf0954cd22.png)

In this case, we don't think the app actually needs `libSystem.IO.Compression.Native.so` or `libSystem.Security.Cryptography.Android.Native.so`.

We think it might be possible to use `--output-pinvokes` and completely drop certain `.so` files from projects.

### Steps to Reproduce

1. `dotnet new android`
2. `dotnet build -c Release`

### Did you find any workaround?

_No response_

### Relevant log output

_No response_

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.