Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot compile apk, Itext and Proguard conflict

I'm developing an Android application, now I have to build an APK, to do this I follow this step:

1) Build -> Clean

2) Build -> Generate Signed APK

3) Jar Signature or Full APK Signature

But while the generation of the application an error occurs:

Information:Gradle tasks [:app:assembleRelease]
Warning:com.itextpdf.text.pdf.PdfEncryptor: can't find referenced class org.spongycastle.cms.jcajce.JceKeyTransEnvelopedRecipient
Warning:com.itextpdf.text.pdf.PdfEncryptor: can't find referenced class org.spongycastle.cms.RecipientInformation
Warning:com.itextpdf.text.pdf.PdfEncryptor: can't find referenced class org.spongycastle.cms.CMSException
Warning:com.itextpdf.text.pdf.PdfEncryptor: can't find referenced class org.spongycastle.cms.RecipientInformation
Warning:com.itextpdf.text.pdf.PdfEncryptor: can't find referenced class org.spongycastle.cms.Recipient
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.DEROutputStream
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.ASN1InputStream
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.DEROctetString
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.DERSet
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.cms.RecipientInfo
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.DERSet
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.x509.AlgorithmIdentifier
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.ASN1ObjectIdentifier
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.x509.AlgorithmIdentifier
Warning:com.itextpdf.text.pdf.PdfPublicKeySecurityHandler: can't find referenced class org.spongycastle.asn1.cms.EncryptedContentInfo
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.asn1.tsp.MessageImprint
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.asn1.ASN1Sequence
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.cert.ocsp.BasicOCSPResp
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.cert.ocsp.SingleResp
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.cert.ocsp.CertificateID
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.operator.DigestCalculator
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.cert.ocsp.CertificateID
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.asn1.ASN1Sequence
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.asn1.ASN1TaggedObject
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.asn1.ASN1Sequence
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.asn1.ASN1OctetString
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.asn1.ASN1InputStream
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.asn1.ocsp.BasicOCSPResponse
Warning:com.itextpdf.text.pdf.security.PdfPKCS7: can't find referenced class org.spongycastle.tsp.TimeStampToken
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SigPolicyQualifierInfo
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.pkcs.PKCSObjectIdentifiers
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.DERIA5String
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SigPolicyQualifierInfo
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SigPolicyQualifiers
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SignaturePolicyIdentifier
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SignaturePolicyId
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.DERObjectIdentifier
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.OtherHashAlgAndValue
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.x509.AlgorithmIdentifier
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.DEROctetString
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.OtherHashAlgAndValue
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SignaturePolicyId
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SignaturePolicyIdentifier
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.pkcs.PKCSObjectIdentifiers
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SignaturePolicyIdentifier
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SigPolicyQualifierInfo
Warning:com.itextpdf.text.pdf.security.SignaturePolicyInfo: can't find referenced class org.spongycastle.asn1.esf.SigPolicyQualifiers
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampRequestGenerator
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.asn1.ASN1ObjectIdentifier
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampRequestGenerator
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampRequest
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampResponse
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.asn1.cmp.PKIFailureInfo
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampResponse
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampToken
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampTokenInfo
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TSPException
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampRequest
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.asn1.cmp.PKIFailureInfo
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampToken
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampTokenInfo
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampRequestGenerator
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampRequest
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampResponse
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.asn1.cmp.PKIFailureInfo
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampToken
Warning:com.itextpdf.text.pdf.security.TSAClientBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampTokenInfo
Warning:com.itextpdf.text.pdf.security.TSAInfoBouncyCastle: can't find referenced class org.spongycastle.tsp.TimeStampTokenInfo
Warning:org.joda.convert.AbstractTypeStringConverter: can't find referenced class com.google.common.collect.ImmutableMap
Warning:org.joda.convert.AbstractTypeStringConverter: can't find referenced class com.google.common.collect.ImmutableMap$Builder
Warning:org.joda.convert.AbstractTypeStringConverter: can't find referenced class com.google.common.collect.ImmutableMap
Warning:org.joda.convert.AbstractTypeStringConverter: can't find referenced class com.google.common.collect.ImmutableMap$Builder
Warning:org.joda.convert.AbstractTypeStringConverter: can't find referenced class com.google.common.collect.ImmutableMap
Warning:org.joda.convert.TypeStringConverter: can't find referenced class com.google.common.reflect.TypeToken
Warning:org.joda.convert.TypeTokenStringConverter: can't find referenced class com.google.common.reflect.TypeToken
Warning:there were 823 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
Information:BUILD FAILED

I don't know how to solve this problem.

What I have tried ?

I have put this code in my proguard-android file (located in \AppData\Local\Android\sdk\tools\proguard).

Rif

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

This solution doesn't work for me, the problem remains the same

**** CURRENT SOLUTION ****

Actually the only one solution that i found is set this value in the gradle:

1)shrinkResources false

2)minifyEnabled false

like image 756
Mattia Avatar asked Mar 28 '17 15:03

Mattia


People also ask

What is minify in Android?

minify is an Android tool that will decrease the size of your application when you go to build it. It's extremely useful as it means smaller apk files! It detects any code or libraries that aren't being used and ignores them from your final apk.

What is R8 in Android?

What is R8? R8 is an app shrinking tool that is used to reduce the size of your application. This tool present in Android Studio works with the rules of Proguard. R8 will convert your app's code into optimized Dalvik code.

How to obfuscate code Android?

You can use the Android ProGuard tool to obfuscate, shrink, and optimize your code. Obfuscated code can be more difficult for other people to reverse engineer. ProGuard renames classes, fields, and methods with semantically obscure names and removes unused code.


1 Answers

Try to put this in proguard-rules

-keep class com.itextpdf.** { *; }
-dontwarn com.itextpdf.**
like image 187
dagung Avatar answered Sep 19 '22 17:09

dagung