1# Some classes in the libraries extend package private classes to chare common functionality 2# that isn't explicitly part of the API 3-dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers 4 5# Preserve line number information for debugging stack traces. 6-keepattributes SourceFile,LineNumberTable 7 8# Annotations are implemented as attributes, so we have to explicitly keep them. 9# Keep all runtime-visible annotations like RuntimeVisibleParameterAnnotations 10# and RuntimeVisibleTypeAnnotations, as well as associated defaults. 11-keepattributes RuntimeVisible*Annotation*,AnnotationDefault 12 13# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations 14-keepclassmembers enum * { 15 public static **[] values(); 16 public static ** valueOf(java.lang.String); 17} 18 19# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native 20-keepclasseswithmembernames,includedescriptorclasses class * { 21 native <methods>; 22} 23 24# class$ methods are inserted by some compilers to implement .class construct, 25# see http://proguard.sourceforge.net/manual/examples.html#library 26-keepclassmembernames class * { 27 java.lang.Class class$(java.lang.String); 28 java.lang.Class class$(java.lang.String, boolean); 29} 30 31# Keep serializable classes and necessary members for serializable classes 32# Copied from the ProGuard manual at http://proguard.sourceforge.net. 33-keepnames class * implements java.io.Serializable 34-keepclassmembers class * implements java.io.Serializable { 35 static final long serialVersionUID; 36 private static final java.io.ObjectStreamField[] serialPersistentFields; 37 !static !transient <fields>; 38 private void writeObject(java.io.ObjectOutputStream); 39 private void readObject(java.io.ObjectInputStream); 40 java.lang.Object writeReplace(); 41 java.lang.Object readResolve(); 42} 43 44# Keep all Javascript API methods 45-keepclassmembers class * { 46 @android.webkit.JavascriptInterface <methods>; 47} 48 49# Keep Throwable's constructor that takes a String argument. 50-keepclassmembers class * extends java.lang.Throwable { 51 <init>(java.lang.String); 52} 53 54# Please specify classes to be kept explicitly in your package's configuration. 55# -keep class * extends android.app.Activity 56# -keep class * extends android.view.View 57# -keep class * extends android.app.Service 58# -keep class * extends android.content.BroadcastReceiver 59# -keep class * extends android.content.ContentProvider 60# -keep class * extends android.preference.Preference 61# -keep class * extends android.app.BackupAgent 62 63# Parcelable CREATORs must be kept for Parcelable functionality 64-keepclassmembers class * implements android.os.Parcelable { 65 public static final ** CREATOR; 66} 67 68# The support library contains references to newer platform versions. 69# Don't warn about those in case this app is linking against an older 70# platform version. We know about them, and they are safe. 71# See proguard-android.txt in the SDK package. 72# 73# DO NOT USE THIS: We figured it's dangerous to blindly ignore all support library warnings. 74# ProGuard may strip members of subclass of unknown super classes, in case an app is linking against 75# LOCAL_SDK_VERSION lower than the support library's LOCAL_SDK_VERSION. 76# See bug/20658265. 77# -dontwarn android.support.** 78 79# From https://github.com/google/guava/wiki/UsingProGuardWithGuava 80# Striped64, LittleEndianByteArray, UnsignedBytes, AbstractFuture 81-dontwarn sun.misc.Unsafe 82# Futures.getChecked (which often won't work with Proguard anyway) uses this. It 83# has a fallback, but again, don't use Futures.getChecked on Android regardless. 84-dontwarn java.lang.ClassValue 85 86# Ignore missing annotation references for various support libraries. 87# While this is not ideal, it should be relatively safe given that 88# 1) runtime-visible annotations will still be kept, and 2) compile-time 89# annotations are stripped by R8 anyway. 90# Note: The ** prefix is used to accommodate jarjar repackaging. 91# TODO(b/242088131): Remove these exemptions after resolving transitive libs 92# dependencies that are provided to R8. 93-dontwarn **android**.annotation*.** 94-dontwarn **com.google.errorprone.annotations.** 95-dontwarn javax.annotation.** 96-dontwarn org.checkerframework.** 97-dontwarn org.jetbrains.annotations.** 98 99# Less spammy. 100-dontnote 101 102# The lite proto runtime uses reflection to access fields based on the names in 103# the schema, keep all the fields. Wildcard is used to apply the rule to classes 104# that have been renamed with jarjar. 105-keepclassmembers class * extends **.protobuf.MessageLite { <fields>; } 106