| 7 | # Not needed for Android and saves a bit of processing time. |
| 8 | -dontpreverify |
| 9 |
| 10 | # Keep line number information, useful for stack traces. |
| 11 | -keepattributes SourceFile,LineNumberTable |
| 12 |
| 13 | # Keep all CREATOR fields within Parcelable that are kept. |
| 14 | -keepclassmembers class * implements android.os.Parcelable { |
| 15 | public static *** CREATOR; |
| 16 | } |
| 17 |
| 18 | # Keep all default constructors for used Fragments. Required since they are |
| 19 | # called reflectively when fragments are reinflated after the app is killed. |
| 20 | -keepclassmembers class * extends android.app.Fragment { |
| 21 | public <init>(); |
| 22 | } |
| 23 | -keepclassmembers class * extends android.support.v4.app.Fragment { |
| 24 | public <init>(); |
| 25 | } |
| 26 | -keepclassmembers class * extends androidx.fragment.app.Fragment { |
| 27 | public <init>(); |
| 28 | } |
| 29 |
| 30 | # Don't obfuscate Parcelables as they might be marshalled outside Chrome. |
| 31 | # If we annotated all Parcelables that get put into Bundles other than |
| 32 | # for saveInstanceState (e.g. PendingIntents), then we could actually keep the |
| 33 | # names of just those ones. For now, we'll just keep them all. |
| 34 | -keepnames class * implements android.os.Parcelable {} |
| 35 |
| 36 | # Keep all enum values and valueOf methods. See |
| 37 | # http://proguard.sourceforge.net/index.html#manual/examples.html |
| 38 | # for the reason for this. Also, see http://crbug.com/248037. |
| 39 | -keepclassmembers enum * { |
| 40 | public static **[] values(); |
| 41 | } |
| 42 |
| 43 | # Allows Proguard freedom in removing these log related calls. |
| 44 | -assumenosideeffects class android.util.Log { |
| 45 | static *** d(...); |
| 46 | static *** v(...); |
| 47 | static boolean isLoggable(...); |
| 48 | } |
| 49 |
| 50 | # The following chart was created on July 20, 2016, to decide on 3 optimization |
| 51 | # passes for Chrome. |
| 52 | # optimization passes | time | .dex size | dirty memory per process |
| 53 | # ----------------------------------------------------------------- |
| 54 | # 1 | 0:48 | 5805676 | 488972 |
| 55 | # 2 | 1:07 | 5777376 | 487092 |
| 56 | # 3 | 1:24 | 5772192 | 486596 |
| 57 | # 4 | 1:42 | 5771124 | 486484 |
| 58 | # 5 | 1:56 | 5770504 | 486432 |
| 59 | -optimizationpasses 3 |
| 60 |
| 61 | # Horizontal class merging marginally increases dex size (as of Mar 2018). |
| 62 | -optimizations !class/merging/horizontal |
| 63 |
| 64 | # Allowing Proguard to change modifiers. This change shrinks the .dex size by |
| 65 | # ~1%, and reduces the method count by ~4%. |
| 66 | -allowaccessmodification |
| 67 |
| 68 | # Workaround for crbug/1002847. Methods of BaseGmsClient are incorrectly |
| 69 | # removed even though they are required for the derived class GmsClient |
| 70 | # to correctly implement Api$Client. |
| 71 | # TODO: remove once crbug/1002847 resolved. |
| 72 | -keep public class com.google.android.gms.common.internal.BaseGmsClient { |
| 73 | public void disconnect(); |
| 74 | public void dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[]); |
| 75 | public int getMinApkVersion(); |
| 76 | public boolean requiresSignIn(); |
| 77 | } |
| 78 |
| 79 | # Protobuf java lite runtime uses reflection |
| 80 | -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite { |
| 81 | <fields>; |
| 82 | } |
| 83 |