This version of www.jasonlam604.com is deprecated.
If you are not redirected to the new web site in 3 seconds, please click on the following link
http://www.jasonlam604.com/v2/index.php
 

 


Obfuscate Multiple JARS using Proguard
by Jason Lam

Okay obfuscating multiple JARS is not a really a big deal, the trick is when one JAR needs to know the how the 1st JAR was obfuscated, with Proguard you can use the filter option. This probably isn't really all that common with J2ME development most times you would deploy your game or application as one JAR. Some case will require JAR splitting, for example, for Blackberry development when deploying a game/application larget then 64 KB via OTA it is required to deploy 2 or more COD files, in this case split JAR obfuscation is required unless of course you don't obfuscate the code. Here is the sample proguard.pro input file:

# The 2 JARS you want obfuscate
-injars C:\HelloWorld\HelloWorldLib.jar
-injars C:\HelloWorld\HelloWorld.jar

# MIDP JARS - Whatever is appropriate here
# for example blackberry could be
# -libraryjars C:\HelloWorld\net_rim_api.jar
#
-libraryjars C:\wtk21\lib\midpapi20.jar.jar;c:\wtk21\lib\cldcapi10.jar

# You need to use the filter option here, more then like you will have to run
# this at least twice, the 1st just to get the mapping.txt
# so you can find out what the class names are obfuscated to, but its more or
# less obvisous they start from a,b,c..... z
#
# The question is which class do you want in which JAR
#
-outjars C:\HelloWorld\obf\HelloWorld.jar(HelloWorld.class,a.class,b.class,c.class)
-outjars C:\HelloWorld\obf\HelloWorldLib.jar

# Print out the mapping
-printmapping C:\HelloWorld\mapping.txt

-verbose
-overloadaggressively
-defaultpackage ''

# Basic - Midlets. Keep all extensions of javax.microedition.midlet.MIDlet.
-keep public class * extends javax.microedition.midlet.MIDlet

 

| Home | Tutorials | Tips / Hints | Books | Links |
| Resume | Portfolio | Services | Contact |

The contents of this webpage are copyright © 2003 - 2006
Jason Lam All Rights Reserved