proguard

<target name="compile" depends="init">
		<echo>Compiling project's .java files into .class files.</echo>
		<echo>${android-jar}</echo>
		<javac encoding="UTF-8" target="1.5" debug="true" extdirs="" srcdir="." destdir="${output-dir}" bootclasspath="${android-jar}">
			<classpath>
				<!--<fileset dir="${external-libs}" includes="*/*.so" /> -->
				<fileset dir="." includes="*.jar" />
			</classpath>
		</javac>
	</target>
	
	<target name="optimize" depends="compile">
		<delete dir="${temp-dir}" />
		<jar basedir="${output-dir}" destfile="${tempjar}" />
		<java jar="${sdk.dir}/tools/proguard/lib/proguard.jar" fork="true" failonerror="true">
			<jvmarg value="-Dmaximum.inlined.code.length=32" />
			<!--输入jar-->
			<arg value="-injars '${tempjar}'" />
			<!--输出jar-->
			<arg value="-outjars '${paasClientjar}'" />
			<arg value="-libraryjars '${android-jar}'" />
			<arg value="-dontshrink" />
			<arg value="-dontoptimize" />
			<arg value="-dontusemixedcaseclassnames" />
			<arg value="-dontpreverify" />
			<arg value="-keep public class com.XXX.XX.** {
				    public &lt;fields&gt;;
				    public &lt;methods&gt;;
				}" />
			<arg value="-keep class com.XXX.info.** {
								    public &lt;fields&gt;;
								    public &lt;methods&gt;;
								}" />
			<!--保留泛型-->
			<arg value="-keepattributes Signature" />
			<!--保留throws-->
			<arg value="-keepattributes Exceptions" />
			<arg value="-flattenpackagehierarchy"/>
		</java>
		<copy file="${paasClientjar}" todir="${release}" />
	</target>
 

你可能感兴趣的:(ProGuard)