michael@0: # Dalvik renders preverification unuseful (Would just slightly bloat the file). michael@0: -dontpreverify michael@0: michael@0: # Uncomment to have Proguard list dead code detected during the run - useful for cleaning up the codebase. michael@0: # -printusage michael@0: michael@0: -dontskipnonpubliclibraryclassmembers michael@0: -verbose michael@0: -allowaccessmodification michael@0: michael@0: # Preserve all fundamental application classes. michael@0: -keep public class * extends android.app.Activity michael@0: -keep public class * extends android.app.Application michael@0: -keep public class * extends android.app.Service michael@0: -keep public class * extends android.app.backup.BackupAgentHelper michael@0: -keep public class * extends android.content.BroadcastReceiver michael@0: -keep public class * extends android.content.ContentProvider michael@0: -keep public class * extends android.preference.Preference michael@0: -keep public class * extends org.mozilla.gecko.sync.syncadapter.SyncAdapter michael@0: -keep class org.mozilla.gecko.sync.syncadapter.SyncAdapter michael@0: michael@0: # Preserve all native method names and the names of their classes. michael@0: -keepclasseswithmembernames class * { michael@0: native ; michael@0: } michael@0: michael@0: -keepclasseswithmembers class * { michael@0: public (android.content.Context, android.util.AttributeSet, int); michael@0: } michael@0: michael@0: -keepclassmembers class * extends android.app.Activity { michael@0: public void *(android.view.View); michael@0: } michael@0: michael@0: # Preserve enums. (For awful reasons, the runtime accesses them using introspection...) michael@0: -keepclassmembers enum * { michael@0: *; michael@0: } michael@0: michael@0: # michael@0: # Rules from ProGuard's Android example: michael@0: # http://proguard.sourceforge.net/manual/examples.html#androidapplication michael@0: # michael@0: michael@0: # Switch off some optimizations that trip older versions of the Dalvik VM. michael@0: michael@0: -optimizations !code/simplification/arithmetic michael@0: michael@0: # Keep a fixed source file attribute and all line number tables to get line michael@0: # numbers in the stack traces. michael@0: # You can comment this out if you're not interested in stack traces. michael@0: michael@0: -renamesourcefileattribute SourceFile michael@0: -keepattributes SourceFile,LineNumberTable michael@0: michael@0: # RemoteViews might need annotations. michael@0: michael@0: -keepattributes *Annotation* michael@0: michael@0: # Preserve all View implementations, their special context constructors, and michael@0: # their setters. michael@0: michael@0: -keep public class * extends android.view.View { michael@0: public (android.content.Context); michael@0: public (android.content.Context, android.util.AttributeSet); michael@0: public (android.content.Context, android.util.AttributeSet, int); michael@0: public void set*(...); michael@0: } michael@0: michael@0: # Preserve all classes that have special context constructors, and the michael@0: # constructors themselves. michael@0: michael@0: -keepclasseswithmembers class * { michael@0: public (android.content.Context, android.util.AttributeSet); michael@0: } michael@0: michael@0: # Preserve the special fields of all Parcelable implementations. michael@0: michael@0: -keepclassmembers class * implements android.os.Parcelable { michael@0: static android.os.Parcelable$Creator CREATOR; michael@0: } michael@0: michael@0: # Preserve static fields of inner classes of R classes that might be accessed michael@0: # through introspection. michael@0: michael@0: -keepclassmembers class **.R$* { michael@0: public static ; michael@0: } michael@0: michael@0: # Preserve the required interface from the License Verification Library michael@0: # (but don't nag the developer if the library is not used at all). michael@0: michael@0: -keep public interface com.android.vending.licensing.ILicensingService michael@0: michael@0: -dontnote com.android.vending.licensing.ILicensingService michael@0: michael@0: # The Android Compatibility library references some classes that may not be michael@0: # present in all versions of the API, but we know that's ok. michael@0: michael@0: -dontwarn android.support.** michael@0: michael@0: # Preserve all native method names and the names of their classes. michael@0: michael@0: -keepclasseswithmembernames class * { michael@0: native ; michael@0: } michael@0: michael@0: # michael@0: # Mozilla-specific rules michael@0: # michael@0: # Merging classes can generate dex warnings about anonymous inner classes. michael@0: -optimizations !class/merging/horizontal michael@0: -optimizations !class/merging/vertical michael@0: michael@0: # Keep miscellaneous targets. michael@0: michael@0: # Keep the annotation. michael@0: -keep @interface org.mozilla.gecko.mozglue.JNITarget michael@0: michael@0: # Keep classes tagged with the annotation. michael@0: -keep @org.mozilla.gecko.mozglue.JNITarget class * michael@0: michael@0: # Keep all members of an annotated class. michael@0: -keepclassmembers @org.mozilla.gecko.mozglue.JNITarget class * { michael@0: *; michael@0: } michael@0: michael@0: # Keep annotated members of any class. michael@0: -keepclassmembers class * { michael@0: @org.mozilla.gecko.mozglue.JNITarget *; michael@0: } michael@0: michael@0: # Keep classes which contain at least one annotated element. Split over two directives michael@0: # because, according to the developer of ProGuard, "the option -keepclasseswithmembers michael@0: # doesn't combine well with the '*' wildcard" (And, indeed, using it causes things to michael@0: # be deleted that we want to keep.) michael@0: -keepclasseswithmembers class * { michael@0: @org.mozilla.gecko.mozglue.JNITarget ; michael@0: } michael@0: -keepclasseswithmembers class * { michael@0: @org.mozilla.gecko.mozglue.JNITarget ; michael@0: } michael@0: michael@0: # Keep Robocop targets. TODO: Can omit these from release builds. Also, Bug 916507. michael@0: michael@0: # Same formula as above... michael@0: -keep @interface org.mozilla.gecko.mozglue.RobocopTarget michael@0: -keep @org.mozilla.gecko.mozglue.RobocopTarget class * michael@0: -keepclassmembers class * { michael@0: @org.mozilla.gecko.mozglue.RobocopTarget *; michael@0: } michael@0: -keepclassmembers @org.mozilla.gecko.mozglue.RobocopTarget class * { michael@0: *; michael@0: } michael@0: -keepclasseswithmembers class * { michael@0: @org.mozilla.gecko.mozglue.RobocopTarget ; michael@0: } michael@0: -keepclasseswithmembers class * { michael@0: @org.mozilla.gecko.mozglue.RobocopTarget ; michael@0: } michael@0: michael@0: # Keep WebRTC targets. michael@0: -keep @interface org.mozilla.gecko.mozglue.WebRTCJNITarget michael@0: -keep @org.mozilla.gecko.mozglue.WebRTCJNITarget class * michael@0: -keepclassmembers class * { michael@0: @org.mozilla.gecko.mozglue.WebRTCJNITarget *; michael@0: } michael@0: -keepclassmembers @org.mozilla.gecko.mozglue.WebRTCJNITarget class * { michael@0: *; michael@0: } michael@0: -keepclasseswithmembers class * { michael@0: @org.mozilla.gecko.mozglue.WebRTCJNITarget ; michael@0: } michael@0: -keepclasseswithmembers class * { michael@0: @org.mozilla.gecko.mozglue.WebRTCJNITarget ; michael@0: } michael@0: michael@0: # Keep generator-targeted entry points. michael@0: -keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI michael@0: -keep @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI class * michael@0: -keepclassmembers class * { michael@0: @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI *; michael@0: } michael@0: -keepclasseswithmembers class * { michael@0: @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI ; michael@0: } michael@0: -keepclasseswithmembers class * { michael@0: @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI ; michael@0: } michael@0: michael@0: -keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI michael@0: -keep @org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI class * michael@0: -keepclassmembers @org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI class * { michael@0: *; michael@0: } michael@0: michael@0: # Disable obfuscation because it makes exception stack traces more difficult to read. michael@0: -dontobfuscate michael@0: michael@0: # Suppress warnings about missing descriptor classes. michael@0: #-dontnote **,!ch.boye.**,!org.mozilla.gecko.sync.**