skip to Main Content

Using visual studio 2022 with Xamarin I am following the steps to prepare and reduce the size of my app for publishing

https://docs.microsoft.com/en-us/xamarin/android/deploy-test/release-prep/proguard

So selecting ProGuard from Code Shrinker dropdown When I rebuild the app, I get the following error:

"Using ProGuard with the D8 DEX compiler is no longer supported. Please set the code shrinker to ‘r8’ in the Visual Studio project property pages or edit the project file in a text editor and set the ‘AndroidLinkTool’ MSBuild property to ‘r8’."

Seeing this error "Using ProGuard with the D8 DEX compiler is no longer supported" I tried to find another option but in Dex Compiler dropdown there is no other option rather than d8 and dex.
If I set the dex compiler to dx, I get the following:

"Using the DX DEX Compiler is not supported. Please set the DEX compiler to ‘d8’ in the Visual Studio project property pages or edit the project file in a text editor and set the ‘AndroidDexTool’ MSBuild property to ‘d8’."

So now my question is how do I enable ProGuard Shrinker option in my app.
I am using visual studio 2022 and android version is 13.0

2

Answers


  1. As the text clearly says you need to change the Code shrinker option to r8 (or nothing) – that is currently set to ProGuard.

    You are changing the wrong option.

    Login or Signup to reply.
  2. You can change the Code shrinker option to r8, try to use Customizing ProGuard to keep some classes. For example: -keep public class xxx. This can effectively reduce the size of the APP.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search