3

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

Umer Farooq
  • 7,356
  • 7
  • 42
  • 67
  • You probably need to keep inner classes: http://stackoverflow.com/questions/14059888/android-proguard-keep-inner-class Note that `keep public class` keeps only public classes not private inner classes – balbusm Jun 24 '15 at 07:32
  • 1
    Have you solved your problem yet? I'm facing the same problem. – TOP Sep 11 '15 at 02:41

0 Answers0