xref: /aosp_15_r20/sdk/files/proguard-android-optimize.txt (revision 1789df15502f1991eff51ff970dce5df8404dd56)
1*1789df15SXin Li# This is a configuration file for ProGuard.
2*1789df15SXin Li# http://proguard.sourceforge.net/index.html#manual/usage.html
3*1789df15SXin Li
4*1789df15SXin Li# Optimizations: If you don't want to optimize, use the
5*1789df15SXin Li# proguard-android.txt configuration file instead of this one, which
6*1789df15SXin Li# turns off the optimization flags.  Adding optimization introduces
7*1789df15SXin Li# certain risks, since for example not all optimizations performed by
8*1789df15SXin Li# ProGuard works on all versions of Dalvik.  The following flags turn
9*1789df15SXin Li# off various optimizations known to have issues, but the list may not
10*1789df15SXin Li# be complete or up to date. (The "arithmetic" optimization can be
11*1789df15SXin Li# used if you are only targeting Android 2.0 or later.)  Make sure you
12*1789df15SXin Li# test thoroughly if you go this route.
13*1789df15SXin Li-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
14*1789df15SXin Li-optimizationpasses 5
15*1789df15SXin Li-allowaccessmodification
16*1789df15SXin Li-dontpreverify
17*1789df15SXin Li
18*1789df15SXin Li# The remainder of this file is identical to the non-optimized version
19*1789df15SXin Li# of the Proguard configuration file (except that the other file has
20*1789df15SXin Li# flags to turn off optimization).
21*1789df15SXin Li
22*1789df15SXin Li-dontusemixedcaseclassnames
23*1789df15SXin Li-dontskipnonpubliclibraryclasses
24*1789df15SXin Li-verbose
25*1789df15SXin Li
26*1789df15SXin Li-keepattributes *Annotation*
27*1789df15SXin Li-keep public class com.google.vending.licensing.ILicensingService
28*1789df15SXin Li-keep public class com.android.vending.licensing.ILicensingService
29*1789df15SXin Li
30*1789df15SXin Li# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
31*1789df15SXin Li-keepclasseswithmembernames class * {
32*1789df15SXin Li    native <methods>;
33*1789df15SXin Li}
34*1789df15SXin Li
35*1789df15SXin Li# keep setters in Views so that animations can still work.
36*1789df15SXin Li# see http://proguard.sourceforge.net/manual/examples.html#beans
37*1789df15SXin Li-keepclassmembers public class * extends android.view.View {
38*1789df15SXin Li   void set*(***);
39*1789df15SXin Li   *** get*();
40*1789df15SXin Li}
41*1789df15SXin Li
42*1789df15SXin Li# We want to keep methods in Activity that could be used in the XML attribute onClick
43*1789df15SXin Li-keepclassmembers class * extends android.app.Activity {
44*1789df15SXin Li   public void *(android.view.View);
45*1789df15SXin Li}
46*1789df15SXin Li
47*1789df15SXin Li# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
48*1789df15SXin Li-keepclassmembers enum * {
49*1789df15SXin Li    public static **[] values();
50*1789df15SXin Li    public static ** valueOf(java.lang.String);
51*1789df15SXin Li}
52*1789df15SXin Li
53*1789df15SXin Li-keepclassmembers class * implements android.os.Parcelable {
54*1789df15SXin Li  public static final android.os.Parcelable$Creator CREATOR;
55*1789df15SXin Li}
56*1789df15SXin Li
57*1789df15SXin Li-keepclassmembers class **.R$* {
58*1789df15SXin Li    public static <fields>;
59*1789df15SXin Li}
60*1789df15SXin Li
61*1789df15SXin Li# The support library contains references to newer platform versions.
62*1789df15SXin Li# Don't warn about those in case this app is linking against an older
63*1789df15SXin Li# platform version.  We know about them, and they are safe.
64*1789df15SXin Li-dontwarn android.support.**
65