1 <?xml version="1.0" encoding="UTF-8"?> 2 <project name="MyAndroidApp" default="help"> 3 4 <!-- The local.properties file is created and updated by the 'android' 5 tool. 6 It contains the path to the SDK. It should *NOT* be checked into 7 Version Control Systems. --> 8 <property file="local.properties" /> 9 10 <!-- The build.properties file can be created by you and is never touched 11 by the 'android' tool. This is the place to change some of the 12 default property values used by the Ant rules. 13 Here are some properties you may want to change/update: 14 15 source.dir 16 The name of the source directory. Default is 'src'. 17 out.dir 18 The name of the output directory. Default is 'bin'. 19 20 Properties related to the SDK location or the project target should 21 be updated using the 'android' tool with the 'update' action. 22 23 This file is an integral part of the build system for your 24 application and should be checked into Version Control Systems. 25 26 --> 27 <property file="build.properties" /> 28 29 <!-- The default.properties file is created and updated by the 'android' 30 tool, as well as ADT. 31 This file is an integral part of the build system for your 32 application and should be checked into Version Control Systems. --> 33 <property file="default.properties" /> 34 35 <!-- Custom Android task to deal with the project target, and import the 36 proper rules. 37 This requires ant 1.6.0 or above. --> 38 <path id="android.antlibs"> 39 <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" /> 40 <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" /> 41 <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" /> 42 </path> 43 44 <taskdef name="setup" 45 classname="com.android.ant.SetupTask" 46 classpathref="android.antlibs" /> 47 48 <!-- extension targets. Uncomment the ones where you want to do custom work 49 in between standard targets --> 50 <!-- 51 <target name="-pre-build"> 52 </target> 53 <target name="-pre-compile"> 54 </target> 55 56 [This is typically used for code obfuscation. 57 Compiled code location: ${out.classes.absolute.dir} 58 If this is not done in place, override ${out.dex.input.absolute.dir}] 59 <target name="-post-compile"> 60 </target> 61 --> 62 63 64 <!-- Execute the Android Setup task that will setup some properties 65 specific to the target, and import the build rules files. 66 67 The rules file is imported from 68 <SDK>/platforms/<target_platform>/ant/ant_rules_r#.xml 69 70 To customize existing targets, there are two options: 71 - Customize only one target: 72 - copy/paste the target into this file, *before* the 73 <setup> task. 74 - customize it to your needs. 75 - Customize the whole script. 76 - copy/paste the content of the rules files (minus the top node) 77 into this file, *after* the <setup> task 78 - disable the import of the rules by changing the setup task 79 below to <setup import="false" />. 80 - customize to your needs. 81 --> 82 83 <setup /> 84 85 <!-- Define a place for the optimized classes. --> 86 <property name="out.proguard.absolute.jar" 87 location="${out.absolute.dir}/classes-processed.jar" /> 88 89 <!-- Define a obfuscation mapping file. --> 90 <property name="out.proguard.absolute.map" 91 location="${out.absolute.dir}/classes-processed.map" /> 92 93 <!-- Redefine the dex help macro, so it converts the optimized classes.. --> 94 <macrodef name="dex-helper"> 95 <element name="external-libs" optional="yes" /> 96 <element name="extra-parameters" optional="yes" /> 97 <sequential> 98 <echo>Converting optimized files into ${intermediate.dex.file}...</echo> 99 <apply executable="${dx}" failonerror="true" parallel="true"> 100 <arg value="--dex" /> 101 <arg value="--output=${intermediate.dex.file}" /> 102 <extra-parameters /> 103 <arg line="${verbose.option}" /> 104 <fileset file="${out.proguard.absolute.jar}" /> 105 <external-libs /> 106 </apply> 107 </sequential> 108 </macrodef> 109 110 <!-- Define the optimization target. --> 111 <taskdef resource="proguard/ant/task.properties" 112 classpath="/home/eric/ProGuard/releases/proguard4.5.1/lib/proguard.jar" /> 113 114 <target name="-post-compile"> 115 <echo>Optimizing compiled files and libraries into ${out.proguard.absolute.jar}...</echo> 116 <proguard printmapping="${out.proguard.absolute.map}"> 117 <injar path="${out.classes.absolute.dir}" /> 118 <injar path="${external.libs.absolute.dir}" /> 119 <outjar path="${out.proguard.absolute.jar}" /> 120 <libraryjar refid="android.target.classpath" /> 121 122 -dontpreverify 123 -repackageclasses '' 124 -allowaccessmodification 125 -optimizations !code/simplification/arithmetic 126 127 <!-- 128 -renamesourcefileattribute SourceFile 129 -keepattributes SourceFile,LineNumberTable 130 --> 131 132 -keepattributes *Annotation* 133 134 -keep public class * extends android.app.Activity 135 -keep public class * extends android.app.Application 136 -keep public class * extends android.app.Service 137 -keep public class * extends android.content.BroadcastReceiver 138 -keep public class * extends android.content.ContentProvider 139 140 -keep public class * extends android.view.View { 141 public <init>(android.content.Context); 142 public <init>(android.content.Context, android.util.AttributeSet); 143 public <init>(android.content.Context, android.util.AttributeSet, int); 144 public void set*(...); 145 } 146 147 -keepclasseswithmembers class * { 148 public <init>(android.content.Context, android.util.AttributeSet); 149 } 150 151 -keepclasseswithmembers class * { 152 public <init>(android.content.Context, android.util.AttributeSet, int); 153 } 154 155 -keepclassmembers class * implements android.os.Parcelable { 156 static android.os.Parcelable$Creator CREATOR; 157 } 158 159 -keepclassmembers class **.R$* { 160 public static <fields>; 161 } 162 163 -keep public interface com.android.vending.licensing.ILicensingService 164 -dontnote com.android.vending.licensing.ILicensingService 165 166 -keepclasseswithmembernames class * { 167 native <methods>; 168 } 169 170 -keepclassmembers class * extends java.lang.Enum { 171 public static **[] values(); 172 public static ** valueOf(java.lang.String); 173 } 174 </proguard> 175 </target> 176 177 </project> 178