|
1 # Dalvik renders preverification unuseful (Would just slightly bloat the file). |
|
2 -dontpreverify |
|
3 |
|
4 # Uncomment to have Proguard list dead code detected during the run - useful for cleaning up the codebase. |
|
5 # -printusage |
|
6 |
|
7 -dontskipnonpubliclibraryclassmembers |
|
8 -verbose |
|
9 -allowaccessmodification |
|
10 |
|
11 # Preserve all fundamental application classes. |
|
12 -keep public class * extends android.app.Activity |
|
13 -keep public class * extends android.app.Application |
|
14 -keep public class * extends android.app.Service |
|
15 -keep public class * extends android.app.backup.BackupAgentHelper |
|
16 -keep public class * extends android.content.BroadcastReceiver |
|
17 -keep public class * extends android.content.ContentProvider |
|
18 -keep public class * extends android.preference.Preference |
|
19 -keep public class * extends org.mozilla.gecko.sync.syncadapter.SyncAdapter |
|
20 -keep class org.mozilla.gecko.sync.syncadapter.SyncAdapter |
|
21 |
|
22 # Preserve all native method names and the names of their classes. |
|
23 -keepclasseswithmembernames class * { |
|
24 native <methods>; |
|
25 } |
|
26 |
|
27 -keepclasseswithmembers class * { |
|
28 public <init>(android.content.Context, android.util.AttributeSet, int); |
|
29 } |
|
30 |
|
31 -keepclassmembers class * extends android.app.Activity { |
|
32 public void *(android.view.View); |
|
33 } |
|
34 |
|
35 # Preserve enums. (For awful reasons, the runtime accesses them using introspection...) |
|
36 -keepclassmembers enum * { |
|
37 *; |
|
38 } |
|
39 |
|
40 # |
|
41 # Rules from ProGuard's Android example: |
|
42 # http://proguard.sourceforge.net/manual/examples.html#androidapplication |
|
43 # |
|
44 |
|
45 # Switch off some optimizations that trip older versions of the Dalvik VM. |
|
46 |
|
47 -optimizations !code/simplification/arithmetic |
|
48 |
|
49 # Keep a fixed source file attribute and all line number tables to get line |
|
50 # numbers in the stack traces. |
|
51 # You can comment this out if you're not interested in stack traces. |
|
52 |
|
53 -renamesourcefileattribute SourceFile |
|
54 -keepattributes SourceFile,LineNumberTable |
|
55 |
|
56 # RemoteViews might need annotations. |
|
57 |
|
58 -keepattributes *Annotation* |
|
59 |
|
60 # Preserve all View implementations, their special context constructors, and |
|
61 # their setters. |
|
62 |
|
63 -keep public class * extends android.view.View { |
|
64 public <init>(android.content.Context); |
|
65 public <init>(android.content.Context, android.util.AttributeSet); |
|
66 public <init>(android.content.Context, android.util.AttributeSet, int); |
|
67 public void set*(...); |
|
68 } |
|
69 |
|
70 # Preserve all classes that have special context constructors, and the |
|
71 # constructors themselves. |
|
72 |
|
73 -keepclasseswithmembers class * { |
|
74 public <init>(android.content.Context, android.util.AttributeSet); |
|
75 } |
|
76 |
|
77 # Preserve the special fields of all Parcelable implementations. |
|
78 |
|
79 -keepclassmembers class * implements android.os.Parcelable { |
|
80 static android.os.Parcelable$Creator CREATOR; |
|
81 } |
|
82 |
|
83 # Preserve static fields of inner classes of R classes that might be accessed |
|
84 # through introspection. |
|
85 |
|
86 -keepclassmembers class **.R$* { |
|
87 public static <fields>; |
|
88 } |
|
89 |
|
90 # Preserve the required interface from the License Verification Library |
|
91 # (but don't nag the developer if the library is not used at all). |
|
92 |
|
93 -keep public interface com.android.vending.licensing.ILicensingService |
|
94 |
|
95 -dontnote com.android.vending.licensing.ILicensingService |
|
96 |
|
97 # The Android Compatibility library references some classes that may not be |
|
98 # present in all versions of the API, but we know that's ok. |
|
99 |
|
100 -dontwarn android.support.** |
|
101 |
|
102 # Preserve all native method names and the names of their classes. |
|
103 |
|
104 -keepclasseswithmembernames class * { |
|
105 native <methods>; |
|
106 } |
|
107 |
|
108 # |
|
109 # Mozilla-specific rules |
|
110 # |
|
111 # Merging classes can generate dex warnings about anonymous inner classes. |
|
112 -optimizations !class/merging/horizontal |
|
113 -optimizations !class/merging/vertical |
|
114 |
|
115 # Keep miscellaneous targets. |
|
116 |
|
117 # Keep the annotation. |
|
118 -keep @interface org.mozilla.gecko.mozglue.JNITarget |
|
119 |
|
120 # Keep classes tagged with the annotation. |
|
121 -keep @org.mozilla.gecko.mozglue.JNITarget class * |
|
122 |
|
123 # Keep all members of an annotated class. |
|
124 -keepclassmembers @org.mozilla.gecko.mozglue.JNITarget class * { |
|
125 *; |
|
126 } |
|
127 |
|
128 # Keep annotated members of any class. |
|
129 -keepclassmembers class * { |
|
130 @org.mozilla.gecko.mozglue.JNITarget *; |
|
131 } |
|
132 |
|
133 # Keep classes which contain at least one annotated element. Split over two directives |
|
134 # because, according to the developer of ProGuard, "the option -keepclasseswithmembers |
|
135 # doesn't combine well with the '*' wildcard" (And, indeed, using it causes things to |
|
136 # be deleted that we want to keep.) |
|
137 -keepclasseswithmembers class * { |
|
138 @org.mozilla.gecko.mozglue.JNITarget <methods>; |
|
139 } |
|
140 -keepclasseswithmembers class * { |
|
141 @org.mozilla.gecko.mozglue.JNITarget <fields>; |
|
142 } |
|
143 |
|
144 # Keep Robocop targets. TODO: Can omit these from release builds. Also, Bug 916507. |
|
145 |
|
146 # Same formula as above... |
|
147 -keep @interface org.mozilla.gecko.mozglue.RobocopTarget |
|
148 -keep @org.mozilla.gecko.mozglue.RobocopTarget class * |
|
149 -keepclassmembers class * { |
|
150 @org.mozilla.gecko.mozglue.RobocopTarget *; |
|
151 } |
|
152 -keepclassmembers @org.mozilla.gecko.mozglue.RobocopTarget class * { |
|
153 *; |
|
154 } |
|
155 -keepclasseswithmembers class * { |
|
156 @org.mozilla.gecko.mozglue.RobocopTarget <methods>; |
|
157 } |
|
158 -keepclasseswithmembers class * { |
|
159 @org.mozilla.gecko.mozglue.RobocopTarget <fields>; |
|
160 } |
|
161 |
|
162 # Keep WebRTC targets. |
|
163 -keep @interface org.mozilla.gecko.mozglue.WebRTCJNITarget |
|
164 -keep @org.mozilla.gecko.mozglue.WebRTCJNITarget class * |
|
165 -keepclassmembers class * { |
|
166 @org.mozilla.gecko.mozglue.WebRTCJNITarget *; |
|
167 } |
|
168 -keepclassmembers @org.mozilla.gecko.mozglue.WebRTCJNITarget class * { |
|
169 *; |
|
170 } |
|
171 -keepclasseswithmembers class * { |
|
172 @org.mozilla.gecko.mozglue.WebRTCJNITarget <methods>; |
|
173 } |
|
174 -keepclasseswithmembers class * { |
|
175 @org.mozilla.gecko.mozglue.WebRTCJNITarget <fields>; |
|
176 } |
|
177 |
|
178 # Keep generator-targeted entry points. |
|
179 -keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI |
|
180 -keep @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI class * |
|
181 -keepclassmembers class * { |
|
182 @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI *; |
|
183 } |
|
184 -keepclasseswithmembers class * { |
|
185 @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI <methods>; |
|
186 } |
|
187 -keepclasseswithmembers class * { |
|
188 @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI <fields>; |
|
189 } |
|
190 |
|
191 -keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI |
|
192 -keep @org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI class * |
|
193 -keepclassmembers @org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI class * { |
|
194 *; |
|
195 } |
|
196 |
|
197 # Disable obfuscation because it makes exception stack traces more difficult to read. |
|
198 -dontobfuscate |
|
199 |
|
200 # Suppress warnings about missing descriptor classes. |
|
201 #-dontnote **,!ch.boye.**,!org.mozilla.gecko.sync.** |