Proguard obfuscates -keep public class files
I have a library project that uses Amazon mobile analytics. When I try to create a .aar artifact 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
It turns out that all these inapplicable classes contain enum in their body. I tried to exclude the whole package that contains these classes from proguard obfuscation, but still the classes are undefinable which seems to me: either the flags don't affect the behavior of the proguard, or I have to add some other flags. Below are the flags I have 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 anyone please tell me how to fix this problem?
EDIT:
I prevented proguard from obfuscating the following classes / packages, that's why it generates these warnings and ultimately an I / O exception in proguardRelease.
-keep public class com.amazonaws.** { *; }
-keep public class com.fasterxml.jackson.core.** { *; }
Regards
source to share
No one has answered this question yet
See similar questions:
or similar: