aboutsummaryrefslogtreecommitdiffstats
path: root/files
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-05-07 16:10:01 -0700
committerTor Norbye <tnorbye@google.com>2012-06-11 15:04:02 -0700
commite86ac701205c6fdb0d2ae91e025024aec4f6a9de (patch)
tree55c5160fa64302f0ddadb71296cf1964c39ebbc9 /files
parent0fcf4bee6d93c5a5b1c449d48f0307abe953454d (diff)
downloadsdk-e86ac701205c6fdb0d2ae91e025024aec4f6a9de.zip
sdk-e86ac701205c6fdb0d2ae91e025024aec4f6a9de.tar.gz
sdk-e86ac701205c6fdb0d2ae91e025024aec4f6a9de.tar.bz2
Include a default proguard config file with optimization
Adds a new proguard-android-optimize.txt file alongside the default proguard-android.txt file in tools/proguard/ which project.properties files can point to. The shrinking rules are the same, but unlike proguard-android.txt, the new config file leave optimization enabled. This allows users to point to a tool-managed proguard file rather than forking the default file in order to edit out the -dontoptimize flag. Change-Id: I2f0fc8361e3964843a4cafe4f4087a6dee68b5ce
Diffstat (limited to 'files')
-rw-r--r--files/proguard-android-optimize.txt64
-rw-r--r--files/proguard-android.txt17
2 files changed, 69 insertions, 12 deletions
diff --git a/files/proguard-android-optimize.txt b/files/proguard-android-optimize.txt
new file mode 100644
index 0000000..f8f5bcb
--- /dev/null
+++ b/files/proguard-android-optimize.txt
@@ -0,0 +1,64 @@
+# This is a configuration file for ProGuard.
+# http://proguard.sourceforge.net/index.html#manual/usage.html
+
+# Optimizations: If you don't want to optimize, use the
+# proguard-android.txt configuration file instead of this one, which
+# turns off the optimization flags. Adding optimization introduces
+# certain risks, since for example not all optimizations performed by
+# ProGuard works on all versions of Dalvik. The following flags turn
+# off various optimizations known to have issues, but the list may not
+# be complete or up to date. (The "arithmetic" optimization can be
+# used if you are only targeting Android 2.0 or later.) Make sure you
+# test thoroughly if you go this route.
+-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
+-optimizationpasses 5
+-allowaccessmodification
+-dontpreverify
+
+# The remainder of this file is identical to the non-optimized version
+# of the Proguard configuration file (except that the other file has
+# flags to turn off optimization).
+
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-verbose
+
+-keepattributes *Annotation*
+-keep public class com.google.vending.licensing.ILicensingService
+-keep public class com.android.vending.licensing.ILicensingService
+
+# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+# keep setters in Views so that animations can still work.
+# see http://proguard.sourceforge.net/manual/examples.html#beans
+-keepclassmembers public class * extends android.view.View {
+ void set*(***);
+ *** get*();
+}
+
+# We want to keep methods in Activity that could be used in the XML attribute onClick
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
+# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+ public static final android.os.Parcelable$Creator *;
+}
+
+-keepclassmembers class **.R$* {
+ public static <fields>;
+}
+
+# The support library contains references to newer platform versions.
+# Don't warn about those in case this app is linking against an older
+# platform version. We know about them, and they are safe.
+-dontwarn android.support.**
diff --git a/files/proguard-android.txt b/files/proguard-android.txt
index 3cc5c8a..fe73bae 100644
--- a/files/proguard-android.txt
+++ b/files/proguard-android.txt
@@ -10,18 +10,11 @@
# of these optimizations on its own).
-dontoptimize
-dontpreverify
-
-# If you want to enable optimization, you should include the
-# following:
-# -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-# -optimizationpasses 5
-# -allowaccessmodification
-#
-# Note that you cannot just include these flags in your own
-# configuration file; if you are including this file, optimization
-# will be turned off. You'll need to either edit this file, or
-# duplicate the contents of this file and remove the include of this
-# file from your project's proguard.config path property.
+# Note that if you want to enable optimization, you cannot just
+# include optimization flags in your own project configuration file;
+# instead you will need to point to the
+# "proguard-android-optimize.txt" file instead of this one from your
+# project.properties file.
-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService