[java] ProGuard Help

Started by
6 comments, last by Wilhelm van Huyssteen 12 years, 10 months ago
Hello I was wondering if anyone here has had Experience with ProGuard and obsfucating java code, If you do and dont mind helping a fellow gamedev'er out I'd like to ask some questions to help me learn how to use it, as I have a BIG application with multiple Librarys I need to obsfucate, and Iam a little intimidated at doing it correctly, I will gladly compensate and time you spend helping. Thank you in advance.
Advertisement
I use Pro Guard to obfuscate my applications. I have some fairly big applications that i succesfuly obfuscated but i dont think i know enough about it to demand payment. For one i have not yet tried to include progaurd in my build process. i simply use the gui to obfuscate the final Jar(s) before distributing. If you have a specific questions ask away.
Cool Thanks!, I havent really tried using it yet, just been reading some documentation. So I guess my first question is where is this "fabled" gui you speak of?, as everything seems to be command line from what I've been reading lol.

So basically this is the thing Iam worried about
I Seperated my Application into few librarys (about 2 not including the actual application itself) So on the actual application itself (I use the Netbeans IDE to do my development) I add the other 2 projects(libraries) as references so Netbeans takes care of the build process for me.

Anyhow This is the basic heirachy of my Application

LibraryA -> LibraryX -> Application

now the Application needs both LibraryA and LibraryX to work

LibraryX actually also references parts of LibraryA

and LibraryA is the only independant library I have (as it doesnt reference either)


Basically this depedance is what Iam worried about, I want to obsfucate my code but I still need it to run, and I cant leave my Libraries no obsfucated And Iam worried that proguard might obsfucate somethign in LibraryX or LibraryA that the Application wont be able to resolve.
When you distribute your application. do you export LibraryA to 1 jar, LibraryX to 1 jar and your application to 1 jar or do you export all your classes to the same jar?
if everything goes into one jar theres no problem. It will just work.
if you seperate it into 3 jars you need to obfuscate them seperatley but for LibraryA and LibraryX youl have to exlude the names of the interface methods from the obfuscation process.
As for the GUI. In the bin folder of your progaurd directory youl find a batch script. proguardgui.bat. (Asuming youre on windows).

Run GUI
Choose the input jar.
Choose the output jar
Choose what to exlude from obfuscation.
Process!
Profit!

Theres a good amount of options to play with but thats the basic idea.

Thanks++

One question should I add or remove anything from the "Library jars, wars, ears, zips, and directories" List?

And even tho I build everything seperately The end product is suppose to be packaged into 1 jar.
with "Library jars, wars, ears, zips, and directories" do you mean jars, wars, ears, zips that gets used by your libraries? Or could you maybe rephrase your question. Not exactly sure what you mean.
Like the gui is seperated by 2 Panels,

one with the buttons to [Add input...] [Add output..] which is labels Program jars, wars... etc...
Thats where IAM ASSUMING I will add all my jar files as input files.

Now in the bottom it also has a panel with a [Add...] button (notice no add input/ouput) labeled Library jars, wars.... etc....
And that one actually comes prepopulated with {JavaHome}\jdk\jr\lib\rt.jar

should I be adding any of my program files to that list or leave it alone and just add it to the first panel with the [Add input...] button
Ah kk.

You dont need to add anything there (asuming your final jar file doesnt rely on any other third party libraries).

rt.jar contains the java standard library. Progaurd considers it an "external dependency" as wel. So leave that there.

This topic is closed to new replies.

Advertisement