blob: aee5271744266fc5181a2e46935123c90e782246 [file] [log] [blame]
Ying Wang7311a342013-08-21 18:32:49 -07001# We have moved -dontobfuscate and -dontoptimize to the makefiles.
Ying Wang3b2bdf12010-02-01 09:51:23 -08002# dex does not like code run through proguard optimize and preverify steps.
Ying Wang7311a342013-08-21 18:32:49 -07003# -dontoptimize
Ying Wang3b2bdf12010-02-01 09:51:23 -08004-dontpreverify
5
6# Don't obfuscate. We only need dead code striping.
Ying Wang7311a342013-08-21 18:32:49 -07007# -dontobfuscate
Ying Wang3b2bdf12010-02-01 09:51:23 -08008
9# Add this flag in your package's own configuration if it's needed.
10#-flattenpackagehierarchy
11
Ying Wang38cdd442013-05-30 10:45:46 -070012# Keep classes and methods that have the guava @VisibleForTesting annotation
Daichi Hironoe2a85aa2015-07-24 17:48:19 +090013-keep @**.VisibleForTesting class *
Ying Wang38cdd442013-05-30 10:45:46 -070014-keepclassmembers class * {
Daichi Hironoe2a85aa2015-07-24 17:48:19 +090015@**.VisibleForTesting *;
Ying Wang38cdd442013-05-30 10:45:46 -070016}
Ying Wang3b2bdf12010-02-01 09:51:23 -080017
Jared Duke7d0c90b2022-05-09 18:09:01 -070018# Keep rule for members that are needed solely to keep alive downstream weak
19# references, and could otherwise be removed after tree shaking optimizations.
20-keepclassmembers,allowaccessmodification,allowobfuscation,allowshrinking class * {
21 @com.android.internal.annotations.KeepForWeakReference <fields>;
22}
23
Jared Duke4bd749b2021-12-14 15:28:33 -080024# Understand the common @Keep annotation from various Android packages:
25# * android.support.annotation
26# * androidx.annotation
27# * com.android.internal.annotations
28-keep class **android**.annotation*.Keep
Colin Cross38b48de2019-03-26 09:48:28 -070029
Jared Duke4bd749b2021-12-14 15:28:33 -080030-keep @**android**.annotation*.Keep class * { *; }
Colin Cross38b48de2019-03-26 09:48:28 -070031
32-keepclasseswithmembers class * {
Jared Duke4bd749b2021-12-14 15:28:33 -080033 @**android**.annotation*.Keep <methods>;
Colin Cross38b48de2019-03-26 09:48:28 -070034}
35
36-keepclasseswithmembers class * {
Jared Duke4bd749b2021-12-14 15:28:33 -080037 @**android**.annotation*.Keep <fields>;
Colin Cross38b48de2019-03-26 09:48:28 -070038}
39
40-keepclasseswithmembers class * {
Jared Duke4bd749b2021-12-14 15:28:33 -080041 @**android**.annotation*.Keep <init>(...);
Colin Cross38b48de2019-03-26 09:48:28 -070042}
43
Ying Wang57453512013-05-17 10:02:00 -070044-include proguard_basic_keeps.flags