Add a hack to enable building a release candidate.

With proguard "-optimizationpasses 5", not able to
obfuscate the CursorLoader. A known issue.

Remove
- AndoridMockRuntime.jar
- googleloginclient-helper.jar
AndoridMockRuntime.jar was included twice, preventing unit tests
from running.

Clean up classpath to not include jar files in the lib directory.
Else the jar files will get included twice.

Move jar files in MyTracks/lib/google-api-client/ to MyTracks/lib
so that proguard can pick up the jar files.

Clean up proguard.cfg into three sections.
- update the config from the default project
- update the config from the Google APIs client library
- remove unnecessary My Tracks specific "-dontwarn"
This commit is contained in:
Jimmy Shih
2012-04-02 18:45:17 -07:00
parent 840576055f
commit a34c17a461
16 changed files with 87 additions and 54 deletions
-14
View File
@@ -1,22 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/googleloginclient-helper.jar"/>
<classpathentry exported="true" kind="lib" path="libs/google-common.jar"/>
<classpathentry kind="lib" path="libs/libGoogleAnalytics.jar"/>
<classpathentry kind="lib" path="libs/google-api-client/commons-codec-1.3.jar"/>
<classpathentry exported="true" kind="lib" path="libs/google-api-client/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="libs/google-api-client/google-api-client-1.5.0-beta.jar"/>
<classpathentry kind="lib" path="libs/google-api-client/google-http-client-1.5.0-beta.jar"/>
<classpathentry kind="lib" path="libs/google-api-client/google-oauth-client-1.5.0-beta.jar"/>
<classpathentry kind="lib" path="libs/google-api-client/gson-1.6.jar"/>
<classpathentry kind="lib" path="libs/google-api-client/guava-r09.jar"/>
<classpathentry kind="lib" path="libs/google-api-client/jackson-core-asl-1.6.7.jar"/>
<classpathentry kind="lib" path="libs/google-api-client/jsr305-1.3.9.jar"/>
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/> <classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="lib" path="/MyTracksLib/libs/protobuf-java-2.3.0-lite.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>
+20 -9
View File
@@ -3,10 +3,21 @@ own licenses, which allow their usage for the My Tracks application. Any other
applications that wish to use these files should consult the appropriate applications that wish to use these files should consult the appropriate
licenses or the JAR's authors. licenses or the JAR's authors.
google-api-client/ Android Support Package:
- see http://code.google.com/p/google-api-java-client/. android-support-v4.jar
- contains Google API client library, google-api-client-1.5.0-beta.jar, and its - see http://developer.android.com/sdk/compatibility-library.html
dependencies.
Google APIs Client Library for Java:
commons-codec-1.3.jar
commons-logging-1.1.1.jar
google-api-client-1.5.0-beta.jar
google-http-client-1.5.0-beta.jar
google-oauth-client-1.5.0-beta.jar
gson-1.6.jar
guava-r09.jar
jackson-core-asl-1.6.7.jar
jsr305-1.3.9.jar
- see http://code.google.com/p/google-api-java-client/
- google-api-client-1.5.0-beta.jar depends on protobuf-java-2.2.0.jar, however, - google-api-client-1.5.0-beta.jar depends on protobuf-java-2.2.0.jar, however,
MyTracksLib already includes protobuf-java.2.3.0-lite.jar. Thus using the MyTracksLib already includes protobuf-java.2.3.0-lite.jar. Thus using the
newer version, protobuf-java.2.3.0-lite.jar. newer version, protobuf-java.2.3.0-lite.jar.
@@ -14,9 +25,9 @@ google-api-client/
some of its classes are already included in the android framework, thus not some of its classes are already included in the android framework, thus not
including xpp3-1.1.4c.jar. including xpp3-1.1.4c.jar.
google-common.jar Google Analytics:
googleloginclient-helper.jar
libGoogleAnalytics.jar libGoogleAnalytics.jar
- see http://code.google.com/mobile/analytics/docs/. - see http://code.google.com/apis/analytics/docs/mobile/android.html
Others:
google-common.jar
Binary file not shown.
+67 -28
View File
@@ -1,44 +1,43 @@
-target 6 #
-optimizationpasses 5 # Section 1
# Default eclipse project proguard settings.
#
-dontusemixedcaseclassnames -dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclasses
-dontpreverify
-verbose -verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
# Add the libraries, but ignore warnings about them -dontpreverify
-libraryjars libs
-libraryjars ../MyTracksLib/libs
-dontwarn com.google.android.googleapps.**
-dontwarn com.android.common.**
-dontwarn com.google.android.gsf.**
-dontwarn org.codehaus.**
-dontwarn com.google.appengine.**
-dontwarn org.apache.avalon.framework.logger.**
-dontwarn org.apache.log.**
-dontwarn org.apache.log4j.**
-dontwarn javax.servlet.**
# Make our stack traces useful -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
# Line numbers will be correct, file names will be replaced by "MT" since the # change from 5 to 2. With 5 passes, the CursorLoader in the android.support.v4 will not compile.
# class name is enough to get the file name. # See http://stackoverflow.com/questions/6605971/android-sdk-tools-revision-12-has-problem-with-proguard-error-conversion-to
-renamesourcefileattribute MT -optimizationpasses 2
-keepattributes SourceFile,LineNumberTable -allowaccessmodification
# Keep everything android references from XMLs -keepattributes *Annotation*
-keep public class * extends android.app.Activity -keep public class * extends android.app.Activity
-keep public class * extends android.app.Application -keep public class * extends android.app.Application
-keep public class * extends android.app.Service -keep public class * extends android.app.Service
-keep public class * extends android.app.backup.BackupAgent
-keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider -keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgent
-keep public class * extends android.preference.Preference -keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.app.Fragment
-keep public class com.android.vending.licensing.ILicensingService -keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembers class * { # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>; native <methods>;
} }
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclasseswithmembers class * { -keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet); public <init>(android.content.Context, android.util.AttributeSet);
} }
@@ -47,6 +46,11 @@
public <init>(android.content.Context, android.util.AttributeSet, int); public <init>(android.content.Context, android.util.AttributeSet, int);
} }
-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 * { -keepclassmembers enum * {
public static **[] values(); public static **[] values();
public static ** valueOf(java.lang.String); public static ** valueOf(java.lang.String);
@@ -56,20 +60,55 @@
public static final android.os.Parcelable$Creator *; public static final android.os.Parcelable$Creator *;
} }
# Needed by google-api-client to keep generic types and @Key annotations accessed via reflection -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.**
#
# Section 2
# Google APIs Client Library for Java proguard settings.
#
# Needed by google-api-client to keep generic types and @Key annotations accessed via reflection
-keepclassmembers class * { -keepclassmembers class * {
@com.google.api.client.util.Key <fields>; @com.google.api.client.util.Key <fields>;
} }
-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault -keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
# Needed by Guava # Needed by Guava
-dontwarn sun.misc.Unsafe -dontwarn sun.misc.Unsafe
# See https://groups.google.com/forum/#!topic/guava-discuss/YCZzeCiIVoI
-dontwarn com.google.common.collect.MinMaxPriorityQueue
#
# Section 3
# My Tracks specific proguard settings.
#
# Add the libraries, but ignore warnings about them
-libraryjars libs
-libraryjars ../MyTracksLib/libs
-dontwarn com.android.common.**
-dontwarn com.google.android.googleapps.**
-dontwarn com.google.android.gsf.**
-dontwarn javax.servlet.**
-dontwarn org.apache.avalon.framework.logger.**
-dontwarn org.apache.log.**
-dontwarn org.apache.log4j.**
# Make our stack traces useful
# Line numbers will be correct, file names will be replaced by "MT" since the
# class name is enough to get the file name.
-renamesourcefileattribute MT
-keepattributes SourceFile,LineNumberTable
# Keep services needed by ANT+ protocol # Keep services needed by ANT+ protocol
-keep public class com.dsi.ant.IAnt_6 -keep public class com.dsi.ant.IAnt_6
-keep public class com.dsi.ant.IAnt -keep public class com.dsi.ant.IAnt
-keep public class com.dsi.ant.IServiceSettings -keep public class com.dsi.ant.IServiceSettings
-1
View File
@@ -3,7 +3,6 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/> <classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="lib" path="libs/protobuf-java-2.3.0-lite.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>
-2
View File
@@ -9,8 +9,6 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/MyTracks"/> <classpathentry combineaccessrules="false" kind="src" path="/MyTracks"/>
<classpathentry kind="lib" path="libs/AndroidMockGenerator.jar"/>
<classpathentry kind="lib" path="libs/robotium-solo-3.1.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>
Binary file not shown.