2013-08-22 03:32:49 +02:00
|
|
|
# We have moved -dontobfuscate and -dontoptimize to the makefiles.
|
2010-02-01 18:51:23 +01:00
|
|
|
# dex does not like code run through proguard optimize and preverify steps.
|
2013-08-22 03:32:49 +02:00
|
|
|
# -dontoptimize
|
2010-02-01 18:51:23 +01:00
|
|
|
-dontpreverify
|
|
|
|
|
|
|
|
# Don't obfuscate. We only need dead code striping.
|
2013-08-22 03:32:49 +02:00
|
|
|
# -dontobfuscate
|
2010-02-01 18:51:23 +01:00
|
|
|
|
|
|
|
# Add this flag in your package's own configuration if it's needed.
|
|
|
|
#-flattenpackagehierarchy
|
|
|
|
|
2023-02-01 19:27:04 +01:00
|
|
|
# Keep classes and members with the platform-defined @VisibleForTesting annotation.
|
|
|
|
-keep @com.android.internal.annotations.VisibleForTesting class *
|
|
|
|
-keepclassmembers class * {
|
|
|
|
@com.android.internal.annotations.VisibleForTesting *;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Keep classes and members with non-platform @VisibleForTesting annotations, but
|
|
|
|
# only within platform-defined packages. This avoids keeping external, library-specific
|
|
|
|
# test code that isn't actually needed for platform testing.
|
2022-08-03 01:05:03 +02:00
|
|
|
# TODO(b/239961360): Migrate away from androidx.annotation.VisibleForTesting
|
|
|
|
# and com.google.common.annotations.VisibleForTesting use in platform code.
|
2023-02-01 19:27:04 +01:00
|
|
|
-keep @**.VisibleForTesting class android.**,com.android.**,com.google.android.**
|
|
|
|
-keepclassmembers class android.**,com.android.**,com.google.android.** {
|
2022-08-03 01:05:03 +02:00
|
|
|
@**.VisibleForTesting *;
|
2013-05-30 19:45:46 +02:00
|
|
|
}
|
2010-02-01 18:51:23 +01:00
|
|
|
|
2022-05-10 03:09:01 +02:00
|
|
|
# Keep rule for members that are needed solely to keep alive downstream weak
|
|
|
|
# references, and could otherwise be removed after tree shaking optimizations.
|
|
|
|
-keepclassmembers,allowaccessmodification,allowobfuscation,allowshrinking class * {
|
|
|
|
@com.android.internal.annotations.KeepForWeakReference <fields>;
|
|
|
|
}
|
|
|
|
|
2021-12-15 00:28:33 +01:00
|
|
|
# Understand the common @Keep annotation from various Android packages:
|
|
|
|
# * android.support.annotation
|
|
|
|
# * androidx.annotation
|
|
|
|
# * com.android.internal.annotations
|
|
|
|
-keep class **android**.annotation*.Keep
|
2019-03-26 17:48:28 +01:00
|
|
|
|
2021-12-15 00:28:33 +01:00
|
|
|
-keep @**android**.annotation*.Keep class * { *; }
|
2019-03-26 17:48:28 +01:00
|
|
|
|
|
|
|
-keepclasseswithmembers class * {
|
2021-12-15 00:28:33 +01:00
|
|
|
@**android**.annotation*.Keep <methods>;
|
2019-03-26 17:48:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-keepclasseswithmembers class * {
|
2021-12-15 00:28:33 +01:00
|
|
|
@**android**.annotation*.Keep <fields>;
|
2019-03-26 17:48:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-keepclasseswithmembers class * {
|
2021-12-15 00:28:33 +01:00
|
|
|
@**android**.annotation*.Keep <init>(...);
|
2019-03-26 17:48:28 +01:00
|
|
|
}
|
|
|
|
|
2023-09-01 23:27:30 +02:00
|
|
|
# Keep Dalvik optimization annotations. These annotations are special in that
|
|
|
|
# 1) we want them preserved for visibility with ART, but 2) they don't have
|
|
|
|
# RUNTIME retention. These minimal keep rules ensure they're not stripped by R8.
|
|
|
|
# TODO(b/215417388): Export this rule from the owning library, core-libart,
|
|
|
|
# via export_proguard_flags_files.
|
|
|
|
-keepclassmembers,allowshrinking,allowoptimization,allowobfuscation,allowaccessmodification class * {
|
|
|
|
@dalvik.annotation.optimization.** *;
|
|
|
|
}
|
|
|
|
|
2013-05-17 19:02:00 +02:00
|
|
|
-include proguard_basic_keeps.flags
|
2023-11-03 01:23:07 +01:00
|
|
|
-include proguard/kotlin.flags
|