Hi Peli, blindfold:

I know it's been a while, but after having put the whole obfuscation
task on the back burner, I decided to come back to it yesterday, and I
just now, with tips from both of you, I have completed setting up an
Ant build script, using ProGuard, that obfuscates my class names very
nicely, and I'd like to thank you both very much for your helpful
comments!

For those still seeking help, I'll just paste the part of my Ant build
script that calls ProGuard, which was partly inspired by the ant build
found here:  
http://code.google.com/p/zxing/source/browse/trunk/android-m3/build.xml?r=321

        <target name="optimize" depends="compile">
                <jar basedir="${outdir-classes}" destfile="temp.jar"/>
                <java jar="${WTK-home}/proguard.jar" fork="true" 
failonerror="true">
                        <jvmarg value="-Dmaximum.inlined.code.length=32"/>
                        <arg value="-injars temp.jar"/>
                        <arg value="-outjars optimized.jar"/>
                        <arg value="-libraryjars ${android-jar}"/>
                        <arg value="-dontpreverify"/>
                        <arg value="-dontoptimize"/>
                        <arg value="-dontusemixedcaseclassnames"/>
                        <arg value="-repackageclasses ''"/>
                        <arg value="-allowaccessmodification"/>
                        <arg value="-keep public class 
zackcorp.android.FirstView"/>
                        <arg value="-keep public class 
zackcorp.android.SyncingView"/>
                        <arg value="-keep public class 
zackcorp.android.ListView"/>
                        <arg value="-optimizationpasses 1"/>
                        <arg value="-verbose"/>
                </java>
                <delete file="temp.jar"/>
                <delete dir="${outdir-classes}"/>
                <mkdir dir="${outdir-classes}"/>
                <unzip src="optimized.jar" dest="${outdir-classes}"/>
                <delete file="optimized.jar"/>
        </target>

This target goes after the compile target, and before the dex target.
I think I was finding that "-dontpreverify" really didn't make much
difference in the end, but -dontoptimize was needed, and -
dontusemixedcaseclassnames is DEFINITELY a must for building on
Windows, if you have a lot of java files (good call, blindfold!)
Also, as peli pointed out, I put all my AndroidManifest listed classes
- FirstView, SyncingView, and ListView - in -keep calls, to be
excluded from obfuscation and this is what made it work.

So I hope this helps other people out, it's not an easy road to
travel!
-UBZack
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to