【问题标题】:How to use resolve error given by Proguard.?如何使用 Proguard 给出的解决错误。?
【发布时间】:2013-11-29 13:37:49
【问题描述】:

我在创建我的应用程序的签名 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.

【问题讨论】:

    标签: android exception apk proguard


    【解决方案1】:

    据我了解,您要求它保留方法,而不是类。

    试试类似的东西

    -keep public class com.ggg.xxx.Yyy { *; }
    
    -keep public class mypackage.MyActivity
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-07
      • 2021-11-24
      • 1970-01-01
      • 2013-12-23
      • 1970-01-01
      • 2019-05-04
      • 2021-10-11
      • 1970-01-01
      相关资源
      最近更新 更多