0

I try to proguard my jar project . I need to avaible only shrinking, so this is my configurations :

<plugin>
            <groupId>com.pyx4me</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>proguard</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <proguardVersion>4.3</proguardVersion>
                <options>
                    <option>-dontobfuscate</option>
                    <option>-optimizationpasses 5</option>
                    <option>-dontoptimize</option>
                    <option>-ignorewarnings</option>
                    <option>-dontskipnonpubliclibraryclasses</option>
                    <option>-dontskipnonpubliclibraryclassmembers</option>
                    <option>-dontpreverify</option>
                    <option>-verbose</option>
                    <option>-dontwarn</option>
                    <option>-dontnote</option>
                    <option>-keepattributes SourceFile, SourceDir</option>
                    <option>-keepattributes *Annotation*</option>
                    <option><![CDATA[
                        -keep class com.myclass.document.** { *; }
                        -keep class com.myclass.connectivity.** { *; }
                        -keep class com.myclass.util.** { *; }
                        -keep class ch.boye.httpclientandroidlib.** { *; }
                        -keep class com.google.** { *;}
                        -keep  class org.joda.time.**  { *;}
                        -keep  class org.apache.log4j.**  { *;}
                        -keep  class org.apache.commons.**  { *;}
                        -keep class java.util.Iterator { *;}
                        -keepclasseswithmembernames class * { native <methods>; }
                        -keepclassmembers enum * { public static **[] values();  public static ** valueOf(java.lang.String); }
                    ]]>
                    </option>
                </options>
                <maxMemory>256m</maxMemory>
                <injar>${project.build.finalName}-jar-with-dependencies.jar</injar>
                <outjar>${project.build.finalName}-jar-with-dependencies.jar</outjar>
                <outputDirectory>${project.build.directory}</outputDirectory>
                <addMavenDescriptor>false</addMavenDescriptor>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>net.sf.proguard</groupId>
                    <artifactId>proguard</artifactId>
                    <version>4.3</version>
                    <scope>runtime</scope>
                    <optional>true</optional>
                </dependency>
            </dependencies>
        </plugin>

And this exception I get on start, but I left almoust all files (-keep) and still get this exception :

 FATAL  UNEXPECTED EXCEPTION CAUGHT in thread main.main
    java.lang.IncompatibleClassChangeError: Class com.google.common.collect.Iterators$7 does not implement the requested interface java.util.Iterator
            at com.google.common.collect.Iterators.getNext(Iterators.java:860)
            at com.google.common.collect.Iterators.find(Iterators.java:728)
            at com.google.common.collect.Iterables.find(Iterables.java:656)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
            at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
    java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
            at java.lang.Thread.run(Thread.java:744)

May be related to : What causes java.lang.IncompatibleClassChangeError?

Community
  • 1
  • 1
igor.stebliy
  • 113
  • 1
  • 8

1 Answers1

0

Fixed by adding:

<libs>
    <lib>${java.home}/lib/rt.jar</lib>
    <lib>${java.home}/lib/jsse.jar</lib>
</libs>
igor.stebliy
  • 113
  • 1
  • 8