Open hansmbakker opened 4 months ago
Google no longer supports DX:
So when you build apps today, it uses D8.
R8 is the equivalent of ProGuard, so that is optional. It would trim unused Java code, but you might have to add some ProGuard rules (same format as before). Not all apps will work with R8 enabled, without adding a few rules.
There might be a section we could add here about this:
@jonathanpeppers thank you for the quick answer!
Are there any settings, other than code shrinking, that developers should consider applying when releasing their app?
Regarding the place for documentation - I would expect this to be in the general documentation of .NET for Android / .NET MAUI - not just in the migration documentation (for new developers this is important, too).
I found these pages:
However, from that last page (VS Project Properties) it's not super clear what the implications are between R8 and ProGuard and how to use it:
As I understood your answer, R8 might need a similar approach (defining rules) to ProGuard:
R8 is the equivalent of ProGuard, so that is optional. It would trim unused Java code, but you might have to add some ProGuard rules (same format as before). Not all apps will work with R8 enabled, without adding a few rules.
Please note, that for https://learn.microsoft.com/en-us/previous-versions/xamarin/android/deploy-test/release-prep/proguard?tabs=windows there is no replacement in the MAUI documentation either.
Furthermore, it does not feel like a clear and complete overview of suggested settings and things to keep in mind (besides the shrinking).
@hansmbakker the suggestions for Release
(and Debug
for that matter) are the project template / just leave all the settings blank.
If you have some need beyond that: such as smaller app size (at the cost of extra work r8
), or faster startup (at the cost of larger app "AOT everything"). You could consider other settings at that point.
Android application type
.NET Android (net7.0-android, net8.0-android, etc.)
Affected platform version
Not relevant
Description
This is a documentation issue - I would like to know what optimization settings are recommended when publishing a Release version to the Google Play store.
For Xamarin there was a lot of detailed documentation:
For .NET MAUI there is no equivalent about what settings to use, and in Visual Studio it looks like R8 is the only recommended code shrinker now. I cannot find a ProGuard option in the project settings and the only shrinker option in Visual Studio is R8:
However, I cannot find any documentation on the R8 shrinker becoming the new default. In the .NET for Android repo there is https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/D8andR8.md which was last updated 6 years ago.
That document says
However, that was 6 years ago...
What are the recommended settings for releasing a .NET for Android / MAUI Android app today?
Steps to Reproduce
Not applicable
Did you find any workaround?
No response
Relevant log output
No response