Last active
December 22, 2015 21:39
-
-
Save StelianMorariu/6534443 to your computer and use it in GitHub Desktop.
Proguard example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-injars bin/classes | |
-injars libs | |
-outjars bin/classes-processed.jar | |
-libraryjars C:\android-sdk\platforms\android-17\android.jar | |
-libraryjars C:\android-sdk\add-ons\addon-google_apis-google-17\libs\maps.jar | |
-optimizationpasses 5 | |
-dontusemixedcaseclassnames | |
-dontskipnonpubliclibraryclasses | |
-dontpreverify | |
-verbose | |
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* | |
-dontwarn android.support.** | |
-keep class android.support.v4.app.** { *; } | |
-keep interface android.support.v4.app.** { *; } | |
-keep class com.actionbarsherlock.** { *; } | |
-keep interface com.actionbarsherlock.** { *; } | |
-keep class com.viewpagerindicator.** { *; } | |
-keep interface com.viewpagerindicator.** { *; } | |
-keep class org.jraf.android.backport.switchwidget.** { *; } | |
-keep interface org.jraf.android.backport.switchwidget.** { *; } | |
-keepattributes *Annotation* | |
-keep public class * extends android.app.Activity | |
-keep public class * extends android.app.Application | |
-keep public class * extends android.app.Service | |
-keep public class * extends android.content.BroadcastReceiver | |
-keep public class * extends android.content.ContentProvider | |
-keep public class * extends android.app.backup.BackupAgentHelper | |
-keep public class * extends android.preference.Preference | |
-keep public class com.android.vending.licensing.ILicensingService | |
-keepclasseswithmembernames class * { | |
native <methods>; | |
} | |
-keepclasseswithmembers class * { | |
public <init>(android.content.Context, android.util.AttributeSet); | |
} | |
-keepclasseswithmembers class * { | |
public <init>(android.content.Context, android.util.AttributeSet, int); | |
} | |
-keepclassmembers class * extends android.content.Context { | |
public void *(android.view.View); | |
public void *(android.view.MenuItem); | |
} | |
-keepclassmembers class * extends android.app.Activity { | |
public void *(android.view.View); | |
} | |
-keepclassmembers enum * { | |
public static **[] values(); | |
public static ** valueOf(java.lang.String); | |
} | |
-keepclassmembers class **.R$* { | |
public static <fields>; | |
} | |
-keep class * implements android.os.Parcelable { | |
public static final android.os.Parcelable$Creator *; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.skayred</groupId> | |
<artifactId>skayred</artifactId> | |
<version>1.26</version> | |
<packaging>apk</packaging> | |
<name>skayred</name> | |
<properties> | |
<environment>development</environment> | |
</properties> | |
<dependencies> | |
<dependency> | |
<groupId>android</groupId> | |
<artifactId>android</artifactId> | |
<version>2.2_r3</version> | |
<scope>provided</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.google.android.maps</groupId> | |
<artifactId>maps</artifactId> | |
<version>8_r2</version> | |
<scope>provided</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.google.http-client</groupId> | |
<artifactId>google-http-client</artifactId> | |
<version>1.6.0-beta</version> | |
<exclusions> | |
<exclusion> | |
<groupId>xpp3</groupId> | |
<artifactId>xpp3</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>com.google.protobuf</groupId> | |
<artifactId>protobuf-java</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.codehaus.jackson</groupId> | |
<artifactId>jackson-core-asl</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>commons-codec</groupId> | |
<artifactId>commons-codec</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>commons-logging</groupId> | |
<artifactId>commons-logging</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.apache.httpcomponents</groupId> | |
<artifactId>httpclient</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.apache.httpcomponents</groupId> | |
<artifactId>httpcore</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>com.google.code.findbugs</groupId> | |
<artifactId>jsr305</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
<dependency> | |
<groupId>com.google.http-client</groupId> | |
<artifactId>google-http-client-extensions-android2</artifactId> | |
<version>1.6.0-beta</version> | |
<exclusions> | |
<exclusion> | |
<groupId>com.google.android</groupId> | |
<artifactId>android</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
<dependency> | |
<groupId>com.google.guava</groupId> | |
<artifactId>guava</artifactId> | |
<version>10.0.1</version> | |
<exclusions> | |
<exclusion> | |
<groupId>com.google.code.findbugs</groupId> | |
<artifactId>jsr305</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
<dependency> | |
<groupId>com.skyhookwireless.wps</groupId> | |
<artifactId>skyhookwireless-wps</artifactId> | |
<version>4.2.0.14</version> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.bugsense.trace</groupId> | |
<artifactId>bugsense-trace</artifactId> | |
<version>1.1.2</version> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-jarsigner-plugin</artifactId> | |
<version>1.2</version> | |
<exclusions> | |
<exclusion> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
</dependencies> | |
<build> | |
<finalName>${project.artifactId}</finalName> | |
<resources> | |
<!-- a pair definition for resource filtering of xml files only (not binary files since they get mangled --> | |
<resource> | |
<directory>${project.basedir}/res</directory> | |
<filtering>true</filtering> | |
<targetPath>${project.build.directory}/filtered-res</targetPath> | |
<includes> | |
<include>**/*.xml</include> | |
</includes> | |
</resource> | |
<resource> | |
<directory>${project.basedir}/res</directory> | |
<filtering>false</filtering> | |
<targetPath>${project.build.directory}/filtered-res</targetPath> | |
<excludes> | |
<exclude>**/*.xml</exclude> | |
</excludes> | |
</resource> | |
</resources> | |
<plugins> | |
<plugin> | |
<artifactId>maven-resources-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>initialize</phase> | |
<goals> | |
<goal>resources</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<groupId>com.jayway.maven.plugins.android.generation2</groupId> | |
<artifactId>android-maven-plugin</artifactId> | |
<version>3.0.0</version> | |
<extensions>true</extensions> | |
<configuration> | |
<resourceDirectory>${project.build.directory}/filtered-res</resourceDirectory> | |
<manifest> | |
<debuggable>true</debuggable> | |
</manifest> | |
<dex> | |
<jvmArguments> | |
<jvmArgument>-Xms256m</jvmArgument> | |
<jvmArgument>-Xmx512m</jvmArgument> | |
</jvmArguments> | |
</dex> | |
<sdk> | |
<platform>8</platform> | |
</sdk> | |
</configuration> | |
<executions> | |
<execution> | |
<id>manifestUpdate</id> | |
<phase>process-resources</phase> | |
<goals> | |
<goal>manifest-update</goal> | |
</goals> | |
</execution> | |
<execution> | |
<id>alignApk</id> | |
<phase>package</phase> | |
<goals> | |
<goal>zipalign</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<profiles> | |
<profile> | |
<id>development</id> | |
<!-- using this since activeByDefault does not work well with multiple profiles --> | |
<activation> | |
<property> | |
<name>environment</name> | |
<value>!production</value> | |
</property> | |
</activation> | |
<properties> | |
<deployment.host>http://192.168.192.15:5000</deployment.host> | |
</properties> | |
</profile> | |
<profile> | |
<id>production</id> | |
<properties> | |
<deployment.host>https://somehost.com</deployment.host> | |
</properties> | |
</profile> | |
<profile> | |
<id>release</id> | |
<properties> | |
<deployment.host>https://somehost.com</deployment.host> | |
</properties> | |
<!-- via this activation the profile is automatically used when the release is done with the maven release | |
plugin --> | |
<activation> | |
<property> | |
<name>performRelease</name> | |
<value>true</value> | |
</property> | |
</activation> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-jarsigner-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>signing</id> | |
<goals> | |
<goal>sign</goal> | |
<goal>verify</goal> | |
</goals> | |
<phase>package</phase> | |
<inherited>true</inherited> | |
<configuration> | |
<removeExistingSignatures>true</removeExistingSignatures> | |
<archiveDirectory/> | |
<includes> | |
<include>${project.build.directory}/${project.artifactId}.apk</include> | |
</includes> | |
<keystore>${sign.keystore}</keystore> | |
<alias>${sign.alias}</alias> | |
<storepass>${sign.storepass}</storepass> | |
<keypass>${sign.keypass}</keypass> | |
<verbose>true</verbose> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<!-- the signed apk then needs to be zipaligned and we activate proguard and we run the manifest | |
update --> | |
<plugin> | |
<groupId>com.jayway.maven.plugins.android.generation2</groupId> | |
<artifactId>android-maven-plugin</artifactId> | |
<inherited>true</inherited> | |
<configuration> | |
<sign> | |
<debug>false</debug> | |
</sign> | |
<zipalign> | |
<verbose>true</verbose> | |
<inputApk>${project.build.directory}/${project.artifactId}.apk</inputApk> | |
<outputApk>${project.build.directory}/${project.artifactId}-signed-aligned.apk | |
</outputApk> | |
</zipalign> | |
<manifest> | |
<debuggable>false</debuggable> | |
<versionCodeAutoIncrement>true</versionCodeAutoIncrement> | |
</manifest> | |
<proguard> | |
<skip>false</skip> | |
</proguard> | |
</configuration> | |
<executions> | |
<execution> | |
<id>manifestUpdate</id> | |
<phase>process-resources</phase> | |
<goals> | |
<goal>manifest-update</goal> | |
</goals> | |
</execution> | |
<execution> | |
<id>alignApk</id> | |
<phase>package</phase> | |
<goals> | |
<goal>zipalign</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>build-helper-maven-plugin</artifactId> | |
<configuration> | |
<artifacts> | |
<artifact> | |
<file>${project.build.directory}/${project.artifactId}-signed-aligned.apk</file> | |
<type>apk</type> | |
<classifier>signed-aligned</classifier> | |
</artifact> | |
<artifact> | |
<file>${project.build.directory}/proguard/mapping.txt</file> | |
<type>map</type> | |
<classifier>release</classifier> | |
</artifact> | |
</artifacts> | |
</configuration> | |
<executions> | |
<execution> | |
<id>attach-signed-aligned</id> | |
<phase>package</phase> | |
<goals> | |
<goal>attach-artifact</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</profile> | |
</profiles> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment