Java >> Problem using ProGuard

by paramindsoftware@gmail.com » Wed, 27 Jun 2007 05:41:05 GMT

Hello.

I'm having trouble obfuscating my jar file using ProGuard 3.9.
My proguard.pro file looks like this:
---------------------------------------------------------------------
-injars
JParaMindAndDictStandard.jar
-outjars
JParaMindAndDict.jar
-libraryjars <java.home>/lib/rt.jar
-printmapping proguard.map
-overloadaggressively
-defaultpackage ''
-allowaccessmodification
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
---------------------------------------------------------------------
And when I call "java -jar C:\proguard3.9\lib\proguard.jar
@proguard.pro", I get the following error message:
---------------------------------------------------------------------
Warning: JParaMind.FindW$9: can't find referenced method 'void access
$900(JParaM
ind.FindW,java.awt.event.ActionEvent)' in class JParaMind.FindW
Warning: JParaMind.SubstH$9: can't find referenced method 'void access
$800(JPara
Mind.SubstH,java.awt.event.ActionEvent)' in class JParaMind.SubstH
Warning: JParaMind.SubstH$8: can't find referenced method 'void access
$700(JPara
Mind.SubstH,java.awt.event.ActionEvent)' in class JParaMind.SubstH
Warning: JParaMind.SmallMerge$9: can't find referenced method 'void
access$1000(
JParaMind.SmallMerge,java.awt.event.ActionEvent)' in class
JParaMind.SmallMerge
Warning: there were 4 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'.
If you are sure the mentioned classes are not used anyway,
you could try your luck using the '-ignorewarnings' option.
Error: Please correct the above warnings first.
---------------------------------------------------------------------
The jar file was created flawlessly by NetBeans, and the application
runs bug-free.
I would appreciate any inputs on what the errors mean and possible
solutions to them.

Thank you.


Java >> Problem using ProGuard

by Zig » Wed, 27 Jun 2007 11:24:41 GMT


Considering that your problems are coming from anonymous classes, that
suggests you have some obsolete classes lingering around in your build
path. Be sure to *clean* your workspace, and try again.

HTH,

On Tue, 26 Jun 2007 17:41:05 -0400, XXXX@XXXXX.COM






Similar Threads

1. using proguard for lib jars

I need to shrink app jar itself and lib jars too, but it dosent work.

I have unpacked jars into a dir, put app classes threre and made a big jar.

Then i used proguard but it still didnt work.




2. Problem with Proguard and JGoodies

3. ProGuard 2.0 released

4. Proguard Error with ant/antenna

5. proguard questions

hi all~

i'm j2me a developer. minutes ago i downloaded proguard to obfuscate
code and reduce jar size, i followed the manual and eventually it
works, all procedure is fine but ! the matter is the .jar file after
obfuscating can not run. it just report an error like: "Error verify
the class Main", Main is the MIDLet class name which kept by -keep
argument. i'd really appreciate if anyone could help.

tks in adv~

6. Proguard Applets and non-overriding methods - Java

7. Proguard Error with ant/antenna

I get the following proguard error:
[wtkobfuscate] java.io.IOException: The output jar is empty. Did you specify
the proper '-keep' optons?
Any idea what is wrong?
Thanks,
earamsey

[b][u]------- actual ant output: ------------[/u][/b]
[wtkobfuscate] Obfuscating C:\Projects\J2ME\CellStory\bin\CellStory.jar with
ProGuard
[wtkobfuscate] ProGuard, version 3.2
[wtkobfuscate] Reading jars...
[wtkobfuscate] Reading program jar
[C:\Projects\J2ME\CellStory\bin\CellStory.jar]
[wtkobfuscate] Reading library zip
[C:\WTK22\wtklib\devices\Series_60_MIDP_SDK_2_1\lib\kmidp20.zip]
[wtkobfuscate] Removing unused library classes...
[wtkobfuscate]     Original number of library classes: 305
[wtkobfuscate]     Final number of library classes:    6
[wtkobfuscate] Shrinking...
[wtkobfuscate] Removing unused program classes and class elements...
[wtkobfuscate]     Original number of program classes: 1
[wtkobfuscate]     Final number of program classes:    0
[b][wtkobfuscate] java.io.IOException: The output jar is empty. Did you
specify the proper '-keep' options?[/b]
    ^^^^^___Error that I get is here
[wtkobfuscate]  at proguard.ProGuard.shrink(ProGuard.java:474)
[wtkobfuscate]  at proguard.ProGuard.execute(ProGuard.java:86)
[wtkobfuscate]  at proguard.ProGuard.main(ProGuard.java:916)

Here is my build.xml file:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<project name="MIDP2.0" default="n66xx" basedir=".">
    <description>
 Build file for MyLittleProject
    </description>
    <!-- predefined antenna tasks -->
    <taskdef resource="antenna.properties"/>
    <!-- ProGuard home -->
    <property name="wtk.proguard.home" value="C:\proguard3.2"/>
    <!-- RetroGuard home -->
    <property name="wtk.retroguard.home" value="C:\retroguard-v2.0.2"/>
    <property name="midlet.name" value="MyLittleProject"/>
    <property name="midlet.home" value="C:\Projects\J2ME\MyLittleProject"/>
    <target name="build" description="Builds everything">
 <antcall target="n66xx"/>
    </target>
    <target name="n66xx" description="Builds Nokia Models 6600 and 6620">
 <ant dir="devices/nokia66xx" inheritall="true" target="build"/>
    </target>
    <target name="cellstory_init" description="Create directory structure">
 <property name="src_pp" location="${preproc_dir}"/>
 <!-- set global properties -->
 <property name="src" location="src"/>
 <property name="bin" location="bin"/>
 <property name="res" location="res"/>
 <property name="classes" location="classes"/>
 <!-- Create the timestamp -->
 <tstamp/>
 <!-- Make directories -->
 <mkdir dir="${src}"/>
 <mkdir dir="${src_pp}"/>
 <mkdir dir="${bin}"/>
 <mkdir dir="${res}"/>
 <mkdir dir="${classes}"/>
    </target>
    <target name="cellstory" depends="cellstory_init" description="Build it
all">
 <wtkjad
     jadfile="${bin}/${midlet.name}.jad"
     jarfile="${midlet.name}.jar"
     name="MyLittleProject"
     vendor="Wizzards and Lizzards"
     version="1.0.0">
     <midlet
  name="${midlet.name}"
  icon="${midlet.name}.png"
  class="${midlet.name}.class"/>
     <attribute
  name="deleteConfirm"
  value="Do you really want to delete me?"/>
 </wtkjad>
 <!-- do preprocessing -->
 <wtkpreprocess
     srcdir="${src}"
     destdir="${src_pp}"
     symbols="${symbols}"/>
 <!-- Compile the code -->
 <wtkbuild
     srcdir="${src_pp}"
     destdir="${classes}"
     deprecation="on"
     target="1.4"
     source="1.4"/>
 <!-- Package the classes -->
 <wtkpackage
     jarfile="${bin}/${midlet.name}.jar"
     jadfile="${bin}/${midlet.name}.jad"
     obfuscate="false"
     preverify="false">
     <fileset dir="${classes}" includes="**/*.class"/>
     <fileset dir="${res}" includes="**"/>
 </wtkpackage>
 <wtkobfuscate
     jarfile="${bin}/${midlet.name}.jar"
     jadfile="${bin}/${midlet.name}.jad"
     tojarfile="${bin}/${midlet.name}._jar"
     obfuscator="proguard">
 </wtkobfuscate>
 <wtkpreverify jarfile="${bin}/${midlet.name}.jar"/>
 <!-- run -->
 <wtkrun jadfile="${bin}/${midlet.name}.jad"
device="Series_60_MIDP_SDK_2_1"/>
    </target>
    <target name="cleanbuild" description="Cleans and builds">
 <ant dir="devices/nokia66xx" inheritall="true" target="cleanbuild"/>
    </target>
</project>
[/code]


8. FW: [FreeBSD] Update Proguard to 3.2