Tuesday, February 15, 2011

Obfuscation problem while deploying J2mePolish App Jar in Web Application

To decrease the size of mobile application in J2ME Polish, it uses obfuscator(Proguard). It renames all the generated classes in it's own way. While deploying the same jar in web application, we cannot use the class name of app.

Eg. We use UseDTO class in J2ME Polish, then it is renamed as aa.class by Proguard.

To overcome the solution, use 'keep' option of obfuscator in build.xml file of J2ME Polish app.

<obfuscator name="Proguard" unless="test">
    <keep class="com.abc.UseDTO">
</obfuscator>


What the above statement does is obfuscate all the class except UserDTO.

Now you can use UserDTO class in web application or any other project.

Thanks