Der Build-Prozess für Android-Programme nimmt durch die Obfuscation einen Extra-Schritt. Das Projekt http://github.com/shareme/AndCooperANT von Fred Grott stellt Ant-Skripte bereit, die helfen, ProGuard richtig einzubinden, sodass die Entschlüsselung von Android-Programmen erschwert wird. Insbesondere mit der Anbindung an den Lizenzserver ist das zentraler Schritt – einige gehackte Programmen haben genau darauf nicht geachtet.
Das zentrale Ant-Skript ist http://github.com/shareme/AndCooperANT/blob/master/add-proguard-release.xml mit den Anpassungen in http://github.com/shareme/AndCooperANT/blob/master/proguard_android_config.txt.
<path id="android.modified.classpath">
<fileset dir="${external.libs.dir}">
<include name="**/*.jar"/>
</fileset>
<path refid="android.target.classpath"/>
</path>
<property name="obfuscate.dir" value="obf" />
<property name="obfuscate.absolute.dir" location="${obfuscate.dir}" />
<property name="android-jar-preobfuscate" value="${obfuscate.absolute.dir}/original.jar" />
<property name="android-jar-postobfuscate" value="${obfuscate.absolute.dir}/postobf.jar" />
<property name="out.dex.input.absolute.dir" value="${android-jar-postobfuscate}" />
<!-- replaces the post-compile step from ant_rules_r3 -->
<target name="-post-compile" depends="-dex-obfuscate,-dex-no-obfuscate">
</target>
<target name="-dex-no-obfuscate" unless="build.mode.release">
<mkdir dir="${obfuscate.absolute.dir}" />
<jar basedir="${out.classes.dir}" destfile="${android-jar-postobfuscate}" />
</target>
<!-- Converts this project's .class files into .dex files -->
<target name="-dex-obfuscate" if="build.mode.release">
<property name="proguard-jar" value="${proguard.dir}/proguard.jar" />
<property name="proguard-conf.dir" value="" />
<property name="proguard-conf.absolute.dir" location="${proguard-conf.dir}" />
<property name="proguard-conf" value="${proguard-conf.absolute.dir}/procfg.txt" />
<property name="libraryjarpath" refid="android.modified.classpath"/>
<!-- Add Proguard Task -->
<taskdef resource="proguard/ant/task.properties" classpath="${proguard-jar}" />
<mkdir dir="${obfuscate.absolute.dir}" />
<delete file="${android-jar-preobfuscate}"/>
<delete file="${android-jar-postobfuscate}"/>
<jar basedir="${out.classes.dir}" destfile="${android-jar-preobfuscate}" />
<proguard>
@${proguard-conf}
-injars ${android-jar-preobfuscate}
-outjars ${android-jar-postobfuscate}
-libraryjars ${libraryjarpath}
-dump ${obfuscate.absolute.dir}/dump.txt
-printseeds ${obfuscate.absolute.dir}/seeds.txt
-printusage ${obfuscate.absolute.dir}/usage.txt
-printmapping ${obfuscate.absolute.dir}/mapping.txt
</proguard>
</target>