Hi guys,
I'm trying to obfuscate my MIDlet so I can use BCrypt and the bouncy castle library. I'm getting the following error and I see that I need to add '-dontskipnonpubliclibraryclasses' and/or '-dontskipnonpubliclibraryclassmembers'. I've read ProGuard's instructions on adding options to an xml file but they are incompatible with Netbeans 6.8's build.xml. How can I set these two options for ProGuard through my build.xml file? I've included the obfuscation related part of my build-imp.xml.
NetBeans Output:
Building jar: C:\Users\Vladimir\Documents\NetBeansProjects\SecureIM_MIDP\build\before-obfuscation.jar
ProGuard, version 4.4
Reading program jar [C:\Users\Vladimir\Documents\NetBeansProjects\SecureIM_MIDP\build\before-obfuscation.jar]
Reading library jar [C:\Java_ME_platform_SDK_3.0\lib\midp_2.0.jar]
Reading library jar [C:\Java_ME_platform_SDK_3.0\lib\cldc_1.1.jar]
Note: duplicate definition of library class [java.io.ByteArrayOutputStream]
Note: there were 1 duplicate class definitions.
Warning: shared.BCrypt: can't find referenced method 'java.lang.Object clone()' in class java.lang.Object
Warning: there were 1 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the options
'-dontskipnonpubliclibraryclasses' and/or
'-dontskipnonpubliclibraryclassmembers'.
Error: Please correct the above warnings first.
C:\Users\Vladimir\Documents\NetBeansProjects\SecureIM_MIDP\build.xml:94: Obfuscation failed with error code 1.
BUILD FAILED (total time: 13 seconds)
build-imp.xml's obfuscation:
<!--proguard-->
<target name="proguard-init" description="Up-to-date check before obfuscation.">
<property name="obfuscation.level" value="0"/>
<condition property="no.obfusc">
<or>
<equals arg1="${obfuscation.level}" arg2="0"/>
<uptodate targetfile="${obfuscator.destjar}">
<srcfiles dir="${buildsystem.baton}"/>
</uptodate>
</or>
</condition>
<uptodate property="obfuscation.up-to-date" targetfile="${obfuscator.destjar}">
<srcfiles dir="${buildsystem.baton}"/>
</uptodate>
</target>
<target name="skip-obfuscation" depends="proguard-init" if="obfuscation.up-to-date">
<fail unless="obfuscated.classes.dir">Must set obfuscated.classes.dir</fail>
<nb-overrideproperty name="buildsystem.baton" value="${obfuscated.classes.dir}"/>
</target>
<target name="proguard" depends="skip-obfuscation" description="Obfuscate project classes." unless="no.obfusc">
<fail unless="obfuscated.classes.dir">Must set obfuscated.classes.dir</fail>
<fail unless="obfuscator.srcjar">Must set obfuscator.srcjar</fail>
<fail unless="obfuscator.destjar">Must set obfuscator.destjar</fail>
<property name="obfuscator.classpath" value=""/>
<dirname file="${obfuscator.srcjar}" property="obfuscator.srcjar.dir"/>
<dirname file="${obfuscator.destjar}" property="obfuscator.destjar.dir"/>
<mkdir dir="${obfuscator.srcjar.dir}"/>
<mkdir dir="${obfuscator.destjar.dir}"/>
<jar jarfile="${obfuscator.srcjar}" basedir="${buildsystem.baton}"/>
<property name="obfuscation.custom" value=""/>
<nb-obfuscate srcjar="${obfuscator.srcjar}" destjar="${obfuscator.destjar}" obfuscatorclasspath="${obfuscator.classpath}" classpath="${platform.bootclasspath}:${extra.classpath}" obfuscationLevel="${obfuscation.level}" extraScript="${obfuscation.custom}"/>
<mkdir dir="${obfuscated.classes.dir}"/>
<unjar src="${obfuscator.destjar}" dest="${obfuscated.classes.dir}"/>
<nb-overrideproperty name="buildsystem.baton" value="${obfuscated.classes.dir}"/>
</target>
<!--obfuscate-->
<target name="pre-obfuscate"/>
<target name="post-obfuscate"/>
<target name="obfuscate" depends="compile,pre-obfuscate,proguard,post-obfuscate" description="Obfuscate project classes."/>
Thanks guys,
jangozo
Edited by: jangozo on Jan 24, 2010 1:55 PM
I just got rid of the BCrypt file.