Forum General

Proguard and shrinking the APK

CorwynCorwyn USMember ✭✭✭

I am following the steps to prepare for publishing my app found here
https://docs.microsoft.com/en-us/xamarin/android/deploy-test/release-prep/proguard

I am at the shrink the APK step and it suggests using proguard. I went to this document for instructions:

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

When I compile with the dex compiler setting, I get the following:
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(556,2): error XA1011: 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.
========== Rebuild All: 1 succeeded, 1 failed, 1 skipped ==========

If I set the dex compiler to dx, I get the following:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(560,2): warning XA1023: Using the DX DEX Compiler is deprecated. Please update $(AndroidDexTool) to d8.

My question(s): Is proguard not the way to go these days and the docs are out of date?

re: What is the actual CURRENT guidance for this?

Tagged:

Answers

  • CorwynCorwyn USMember ✭✭✭

    Hopefully bubbling this up. Does anyone have any info on this?
    Additionally, if I use code shrinking the release version crashes when run.

    Does anyone know of any resources on this subject?

  • DevwasdDevwasd Member ✭✭

    @Corwyn , I'm having the same problem, did you already find the solution?

  • CorwynCorwyn USMember ✭✭✭

    @Devwasd said:
    @Corwyn , I'm having the same problem, did you already find the solution?

    Not yet. I have a thread over on the new forums that I have not responded to yet that is getting traction. Though I realized from the answers I had not been complete in my problem statement in that the r8/d8 solution fails.

    https://docs.microsoft.com/en-us/answers/questions/174035/proguard-and-shrinking-the-apk.html?childToView=186648

    I am hoping to find time this weekend to follow up with a more complete/coherent response there.

  • keivan_mousavikeivan_mousavi USMember ✭✭

    I have the same problem
    I updated NDK 21 and Xamarin.Forms 4.8.0.1821
    This problem solved but other problem 😁 the size of the created file is very large (255m) 😵

Sign In or Register to comment.