1# We have moved -dontobfuscate and -dontoptimize to the makefiles. 2# dex does not like code run through proguard optimize and preverify steps. 3# -dontoptimize 4-dontpreverify 5 6# Don't obfuscate. We only need dead code striping. 7# -dontobfuscate 8 9# Add this flag in your package's own configuration if it's needed. 10#-flattenpackagehierarchy 11 12# Keep classes and members with the platform-defined @VisibleForTesting annotation. 13-keep @com.android.internal.annotations.VisibleForTesting class * 14-keepclassmembers class * { 15 @com.android.internal.annotations.VisibleForTesting *; 16} 17 18# Keep classes and members with non-platform @VisibleForTesting annotations, but 19# only within platform-defined packages. This avoids keeping external, library-specific 20# test code that isn't actually needed for platform testing. 21# TODO(b/239961360): Migrate away from androidx.annotation.VisibleForTesting 22# and com.google.common.annotations.VisibleForTesting use in platform code. 23-keep @**.VisibleForTesting class android.**,com.android.**,com.google.android.** 24-keepclassmembers class android.**,com.android.**,com.google.android.** { 25 @**.VisibleForTesting *; 26} 27 28# Keep rule for members that are needed solely to keep alive downstream weak 29# references, and could otherwise be removed after tree shaking optimizations. 30-keepclassmembers,allowaccessmodification,allowobfuscation,allowshrinking class * { 31 @com.android.internal.annotations.KeepForWeakReference <fields>; 32} 33 34# Understand the common @Keep annotation from various Android packages: 35# * android.support.annotation 36# * androidx.annotation 37# * com.android.internal.annotations 38-keep class **android**.annotation*.Keep 39 40-keep @**android**.annotation*.Keep class * { *; } 41 42-keepclasseswithmembers class * { 43 @**android**.annotation*.Keep <methods>; 44} 45 46-keepclasseswithmembers class * { 47 @**android**.annotation*.Keep <fields>; 48} 49 50-keepclasseswithmembers class * { 51 @**android**.annotation*.Keep <init>(...); 52} 53 54-include proguard_basic_keeps.flags 55