How to use proguard optimizer tool with xamarin forms

前端 未结 1 1846
天命终不由人
天命终不由人 2021-01-17 03:37

I want to reduce size of .apk file, so I am checking Enable ProGuard option in Android project\'s property window but getting compile time error

Error &q

1条回答
  •  爱一瞬间的悲伤
    2021-01-17 04:28

    Follow below steps

    • First you need to add proguard.cfg to your android project level.
    • Change proguard.cfg file build action to ProguardConfiguration
    • Change proguard.cfg file Encoding using Notepad++ to UTF-8

    If you are getting warnings then you need to use -dontwarn attribute like below

    -dontwarn com.symbol.emdk.**
    -dontwarn org.apache.http.**
    -dontwarn com.appdynamics.eumagent.runtime.**
    

    You must need to remove/solve warning because that cause above error. Above code will remove all of your warnings.
    If you are getting exception after executing your application you need to use -keep attribute. like below for required classes

    -keep public class android.support.v7.widget.** { *; }
    

    0 讨论(0)
提交回复
热议问题