gpt4 book ai didi

android - 如果我使用 itext 库 jar,则会出现 Proguard 错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:22:48 26 4
gpt4 key购买 nike

Proguard 不能与 iText 库一起使用。错误与 org.spongycaSTLe.** org.bouncycaSTLe.*com.itext.pdf.** 有关 我试过在这些包上使用 keep 但没有成功。

我的 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.

最佳答案

这适用于 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

关于android - 如果我使用 itext 库 jar,则会出现 Proguard 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23058480/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com