爲了配置Android ant構建系統即使使用debug
構建也調用proguard,需要設置兩個變量:proguard.enabled
和out.dex.jar.input.ref
。
這是示例配置。將custom_rules.xml
文件直接放在您的項目根目錄中。
custom_rules.xml
<project name="android_rules" default="debug">
<!-- Zap debug-obfuscation-check from SDK's build.xml so that it
can't set proguard.enabled to false !-->
<target name="-debug-obfuscation-check"/>
<target name="-pre-build">
<condition property="proguard.enabled" value="true" else="false">
<isset property="proguard.config" />
</condition>
<if condition="${proguard.enabled}">
<then>
<echo level="info">Proguard.config is enabled</echo>
<!-- Secondary dx input (jar files) is empty since all the
jar files will be in the obfuscated jar -->
<path id="out.dex.jar.input.ref" />
</then>
<else>
<echo level="info">Proguard.config is disabled</echo>
</else>
</if>
</target>
</project>