如何使用Proguard给出的解决错误。?

时间:2013-11-29 13:37:49

标签: android exception apk proguard

我在创建应用程序的签名apk 时收到此异常。 我使用了两个外部库。我是 Proguard 的新手。请帮忙! 这是我的配置文件:

    -dontwarn android.support.**
    -dontwarn aspose-cells-2.0.0.**
    -injars       mylibs/aspose-cells-2.0.0.jar
    -outjars      out.jar
    -libraryjars  <java.home>/lib/rt.jar
    -printmapping out.map

    -keepparameternames
    -renamesourcefileattribute SourceFile
    -keepattributes Exceptions,InnerClasses,Signature,Deprecated,
            SourceFile,LineNumberTable,*Annotation*,EnclosingMethod

    -keep public class * {
        public protected *;
    }

    -keepclassmembernames class * {
        java.lang.Class class$(java.lang.String);
        java.lang.Class class$(java.lang.String, boolean);
    }

    -keepclasseswithmembernames class * {
        native <methods>;
    }     

    -keepclassmembers enum * {
        public static **[] values();
        public static ** valueOf(java.lang.String);
    }

    -keepclassmembers class * implements java.io.Serializable {
        static final long serialVersionUID;
        private static final java.io.ObjectStreamField[] serialPersistentFields;
        private void writeObject(java.io.ObjectOutputStream);
        private void readObject(java.io.ObjectInputStream);
        java.lang.Object writeReplace();
        java.lang.Object readResolve();
    }

以下是控制台中的例外

    Proguard returned with error code 1. See console
    Note: there were 3714 duplicate class definitions.
    Warning: com.aspose.cells.a.f.c: can't find referenced class org.apache.tools.zip.ZipEntry
    Warning: com.aspose.cells.a.f.c: can't find referenced class org.apache.tools.zip.ZipFile
    Warning: com.aspose.cells.a.f.c: can't find referenced class org.apache.tools.zip.ZipEntry
    Warning: com.aspose.cells.a.f.c: can't find referenced class org.apache.tools.zip.ZipEntry
    Warning: com.aspose.cells.a.f.c: can't find referenced class org.apache.tools.zip.ZipFile
    Warning: com.aspose.cells.a.f.c: can't find referenced class org.apache.tools.zip.ZipFile
    Warning: com.aspose.cells.a.f.c: can't find referenced class org.apache.tools.zip.ZipFile
    Warning: com.aspose.cells.a.f.f: can't find referenced class org.apache.tools.zip.ZipFile
    Warning: com.aspose.cells.a.f.f: can't find referenced class org.apache.tools.zip.ZipFile
    Warning: com.aspose.cells.a.f.f: can't find referenced class org.apache.tools.zip.ZipFile
    Warning: org.bouncycastle.util.AllTests: can't find referenced class junit.textui.TestRunner
    Warning: org.bouncycastle.util.AllTests: can't find referenced class junit.textui.TestRunner
    Warning: org.bouncycastle.util.io.pem.AllTests: can't find referenced class junit.textui.TestRunner
    Warning: org.bouncycastle.util.io.pem.AllTests: can't find referenced class junit.textui.TestRunner
    Warning: there were 14 unresolved references to classes or interfaces.
      You may need to specify additional library jars (using '-libraryjars').
    Error: Please correct the above warnings first.

1 个答案:

答案 0 :(得分:0)

据我所知,你要求它保留方法,而不是类。

尝试类似

的内容
-keep public class com.ggg.xxx.Yyy { *; }

-keep public class mypackage.MyActivity

http://proguard.sourceforge.net/#manual/examples.html