我想混淆我的纯 Java 库,但我不确定如何在我的 build.xml 文件中使用 dexguard。有人可以给我举个例子吗?我当前的代码如下:
<property file="build.properties"/>
<taskdef resource="build.properties"
classpath="dexguard.jar" />
<target name="build">
<antcall target="clean"/>
</target>
<target name="clean">
<delete dir="build"/>
<antcall target="compile"/>
</target>
<target name="compile">
<mkdir dir="build/classes"/>
<javac srcdir="src" destdir="build/classes"/>
<antcall target="jar"/>
</target>
<target name="jar" >
<mkdir dir="build/jar"/>
<jar destfile="build/jar/testlib.jar" basedir="build/classes">
</jar>
<antcall target="obfuscate"/>
</target>
<target name="obfuscate"
description="Obfuscate compiled classes">
<dexguard>
-libraryjars "dexguard.jar"
-injars build/jar/testlib.jar
-outjars build/jar/testlib_obf.jar
</dexguard>
<target name="run">
<java jar="build/jar/testlib.jar" fork="true"/>
</target>