-
Notifications
You must be signed in to change notification settings - Fork 564
Description
Android application type
.NET Android (net7.0-android, etc.)
Affected platform version
VS 2022 17.7.4
Description
I am using R8 linking in Release mode as it produces much smaller APK files:
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<AndroidLinkTool>r8</AndroidLinkTool>
<TrimMode>full</TrimMode>
</PropertyGroup>
On fresh installations of Visual Studio + the Android SDK, the tools/proguard/ folder is missing, causing runtime crashes, because too much is being linked out (e.g. android.view.View_IOnClickListenerImplementor)
Even if it is opt-in, I would expect the R8 linking to work, as it is also documented here: https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/D8andR8.md
Steps to Reproduce
- Freshly install VS 2022 incl. Android SDK (alternatively, delete existing
C:\Program Files (x86)\Android\android-sdk\tools\proguardfolder) - Enable R8 using
AndroidLinkToolproperty - Build & run the app in Release mode
Did you find any workaround?
It is possible to workaround the problem by copying one of those files into the C:\Program Files (x86)\Android\android-sdk\tools\proguard folder and rename it to proguard-android.txt:
https://android.googlesource.com/platform/sdk/+/refs/heads/main/files/proguard-android.txt
https://android.googlesource.com/platform/sdk/+/refs/heads/main/files/proguard-android-optimize.txt
However, this workaround only seems to work when building with .NET7 - when using .NET8, the app crashes regardless
Relevant log output
C:\Program Files (x86)\Android\android-sdk\tools\proguard\proguard-android.txt : warning XA4304: ProGuard configuration file 'C:\Program Files (x86)\Android\an
droid-sdk\tools\proguard\proguard-android.txt' was not found. Possibly related bug report: #3789