2014-04-14 4 views
4

Proguard는 iText 라이브러리에서 작동하지 않습니다. 오류는 org.spongycastle.**org.bouncycastle.*com.itext.pdf.**과 관련이 있습니다.이 패키지를 계속 사용하지 않으려 고 노력했습니다.라이브러리를 사용하는 경우 Proguard 오류

내 난독 설정 파일은 이것이다 :

-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* 
-optimizationpasses 5 
-allowaccessmodification 
-dontpreverify 

-dontusemixedcaseclassnames 
-dontskipnonpubliclibraryclasses 
-verbose 

-keepattributes *Annotation* 
-keep public class com.google.vending.licensing.ILicensingService 
-keep public class com.android.vending.licensing.ILicensingService 

# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native 
-keepclasseswithmembernames class * { 
    native <methods>; 
} 

-keepclassmembers public class * extends android.view.View { 
    void set*(***); 
    *** get*(); 
} 

-keepclassmembers class * extends android.app.Activity { 
    public void *(android.view.View); 
} 

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

-keep class * implements android.os.Parcelable { 
    public static final android.os.Parcelable$Creator *; 
} 

-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(); 
} 

-keepclassmembers class **.R$* { 
    public static <fields>; 
} 

-dontwarn android.support.** 
-dontwarn javax.activation.** 
-dontwarn org.apache.** 
-dontwarn org.bouncycastle.** 
-dontwarn sun.misc.Unsafe 
-dontwarn com.google.** 
-dontwarn com.esotericsoftware.** 
-dontwarn javax.naming.** 

-libraryjars <java.home>/lib/rt.jar 

-keepattributes *Annotation* 

-keep public class * extends android.content.BroadcastReceiver 
-keep public class * extends android.content.ContentProvider 
-keep public class com.android.vending.licensing.ILicensingService 
-keep class com.google.** 
-keep class * extends com.google.api.client.json.GenericJson { 
*; 
} 
-keep class javax.** {*;} 
-keep class java.lang.reflect.** 
-keep class com.sun.** {*;} 
-keep class myjava.** {*;} 
-keep class org.apache.** 
-keep class org.bouncycastle.** 
-keep public class Mail {*;} 
-keep public class * extends android.app.Service 
-keep public class * extends android.content.BroadcastReceiver 
-keep public class * extends android.content.ContentProvider 
-keep class org.spongycastle.** 
-keep class com.itextpdf.text.pdf.** {*;} 
-keep class com.esotericsoftware.** 

-dontshrink 

Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.RIPEMD160$Digest 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.RIPEMD256$Digest 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.GOST3411$Digest 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.MD2 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.MD5 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.SHA1 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.SHA224 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.SHA256 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.SHA384 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.SHA512 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.RIPEMD128 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.RIPEMD160 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.RIPEMD256 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.BouncyCastleDigest: can't find referenced class org.spongycastle.jcajce.provider.digest.GOST3411 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateInfo: can't find referenced class org.spongycastle.asn1.ASN1Sequence 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateInfo: can't find referenced class org.spongycastle.asn1.ASN1InputStream 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateInfo: can't find referenced class org.spongycastle.asn1.ASN1TaggedObject 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateInfo: can't find referenced class org.spongycastle.asn1.ASN1Primitive 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateInfo$X500Name: can't find referenced class org.spongycastle.asn1.ASN1Sequence 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateInfo$X500Name: can't find referenced class org.spongycastle.asn1.ASN1Set 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateInfo$X500Name: can't find referenced class org.spongycastle.asn1.ASN1String 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateInfo$X500Name: can't find referenced class org.spongycastle.asn1.ASN1ObjectIdentifier 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateUtil: can't find referenced class org.spongycastle.asn1.x509.Extension 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.CertificateUtil: can't find referenced class org.spongycastle.asn1.ASN1ObjectIdentifier 
Error:ProGuard: [MyApp] Warning: com.itextpdf.text.pdf.security.TSAInfoBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampTokenInfo 
Error:ProGuard: [MyApp] Warning: there were 667 unresolved references to classes or interfaces. 
Error:ProGuard: [MyApp]   You may need to add missing library jars or update their versions. 
Error:ProGuard: [MyApp]   If your code works fine without the missing classes, you can suppress 
Error:ProGuard: [MyApp]   the warnings with '-dontwarn' options. 

답변

9

이 두 라인을 시도 오류 로그 :

-keep class org.spongycastle.** { *; } 
-dontwarn org.spongycastle.** 

귀하의 로그 캣이 이미 말하고있다 :

누락 된 클래스없이 코드가 올바르게 작동하면 '-dontwarn'옵션을 사용하여 경고를 표시하지 않을 수 있습니다.

+2

의 차이점은 무엇입니까? -keep class org.spongycastle. ** {*; }'및'-keep class org.spongycastle. **'? – AndreaF

+2

-keep class org.spongycastle. ** {*; }는 패키지 에있는 모든 클래스 이름과 클래스 메소드/필드를 유지하고 -keep 클래스 org.spongycastle. **은 모든 클래스를 패키지로 유지한다는 것을 의미합니다. – KRP

4

이를 위해 잘 작동 itextg-5.5.10

# proguard configuration for iText 

-keep class org.spongycastle.** { *; } 
-dontwarn org.spongycastle.** 

-keep class com.itextpdf.** { *; } 

-keep class javax.xml.crypto.dsig.** { *; } 
-dontwarn javax.xml.crypto.dsig.** 

-keep class org.apache.jcp.xml.dsig.internal.dom.** { *; } 
-dontwarn org.apache.jcp.xml.dsig.internal.dom.** 

-keep class javax.xml.crypto.dom.** { *; } 
-dontwarn javax.xml.crypto.dom.** 

-keep class org.apache.xml.security.utils.** { *; } 
-dontwarn org.apache.xml.security.utils.** 

-keep class javax.xml.crypto.XMLStructure 
-dontwarn javax.xml.crypto.XMLStructure 
2

나는 테이블에 추가 할 이미지를 사용하고 내가 NoSuchMethodFound 같은 오류가있어 : 난독 화의 행 다음

내가 추가를 , 그것의 일 벌금.

-keep class org.spongycastle.** { *; } 
-dontwarn org.spongycastle.** 

-keep class com.itextpdf.text.** { *; } 
-dontwarn com.itextpdf.text.** 

감사합니다.

관련 문제