Proguard obfuscates -keep public class files

733 views Asked by At

I have a library project which uses Amazon mobile analytics. When I try to generate artifact .aar file, proguard gives me

:app:proguardRelease
Warning: com.amazonaws.auth.policy.conditions.S3ConditionFactory: can't find referenced class com.amazonaws.services.s3.model.CannedAccessControlList

Warning: com.amazonaws.util.json.JacksonFactory: can't find referenced class com.fasterxml.jackson.core.JsonFactory

Warning: com.amazonaws.util.json.JacksonFactory: can't find referenced class com.fasterxml.jackson.core.JsonToken

Warning: com.amazonaws.util.json.JacksonFactory$JacksonReader: can't find referenced class com.fasterxml.jackson.core.JsonParser

Warning: com.amazonaws.util.json.JacksonFactory$JacksonWriter: can't find referenced class com.fasterxml.jackson.core.JsonGenerator

Warning: there were 66 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardRelease FAILED

Turns out all these unreferencable classes contain enum in their body. I tried to exclude the whole package which contains these classes from proguard's obfuscation but still the classes are unreferencable, which to me looks like: Either the flags are not affecting proguard's behavior or I have to add some other flags as well. Following are the flags I used.

-keepattributes *Annotation*    
-keepattributes InnerClasses

#-keep class com.fasterxml.jackson.core.JsonToken { *; }
#-keep class com.fasterxml.jackson.core.JsonParser { *; }
#-keep class com.fasterxml.jackson.core.JsonGenerator { *; }

Can anybody give me a headsup on how to resolve this issue?

EDIT:

I have forbidden proguard from obfuscating the following classes/packages, then why does it generates these warnings and eventually I/O exception in proguardRelease.

-keep public class com.amazonaws.** { *; }
-keep public class com.fasterxml.jackson.core.** { *; }

Best Regards

0

There are 0 answers