Saripaar Caused by: java.lang.NoSuchFieldException: LONG

Hi I have a problem with my release version where I am using proguard. In debugging, everything works fine. When I try to call: validator.validate (); they throw:

java.lang.NoSuchFieldError
at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:688)
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:663)
at libcore.reflect.AnnotationAccess.annotationSetToAnnotations(AnnotationAccess.java:633)
at libcore.reflect.AnnotationAccess.getDeclaredAnnotations(AnnotationAccess.java:161)
at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:234)
at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:104)
at com.mobsandgeeks.saripaar.Validator.getViewFieldsWithAnnotations(SourceFile:478)
at com.mobsandgeeks.saripaar.Validator.getSaripaarAnnotatedFields(SourceFile:453)
at com.mobsandgeeks.saripaar.Validator.validateAllRules(SourceFile:346)
at com.mobsandgeeks.saripaar.Validator.validate(SourceFile:156)
at pl.someclass.fragment.RegistrationFragment$1.onClick(SourceFile:92)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NoSuchFieldException: LONG
at java.lang.Class.getDeclaredField(Class.java:886)
at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:685)
... 20 more
java.lang.NoSuchFieldException: LONG
at java.lang.Class.getDeclaredField(Class.java:886)
at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:685)
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:663)
at libcore.reflect.AnnotationAccess.annotationSetToAnnotations(AnnotationAccess.java:633)
at libcore.reflect.AnnotationAccess.getDeclaredAnnotations(AnnotationAccess.java:161)
at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:234)
at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:104)
at com.mobsandgeeks.saripaar.Validator.getViewFieldsWithAnnotations(SourceFile:478)
at com.mobsandgeeks.saripaar.Validator.getSaripaarAnnotatedFields(SourceFile:453)
at com.mobsandgeeks.saripaar.Validator.validateAllRules(SourceFile:346)
at com.mobsandgeeks.saripaar.Validator.validate(SourceFile:156)
at pl.someclass.fragment.RegistrationFragment$1.onClick(SourceFile:92)

      

Has anyone had a similar problem?

This is my proguard-rules.pro file:

-dontwarn javax.management.**
-dontwarn java.lang.management.**
-dontwarn javax.xml.**
-dontwarn org.apache.**
-dontwarn org.slf4j.**

-keep class com.facebook.** { *; }
-keepattributes Signature

-dontwarn com.google.code.**
-dontwarn oauth.signpost.**
-keep class twitter4j.** { *; }

#javamail
-dontwarn java.awt.**
-dontwarn java.beans.Beans
-dontwarn javax.security.**

-keep class javamail.** {*;}
-keep class javax.mail.** {*;}
-keep class javax.activation.** {*;}

-keep class com.sun.mail.dsn.** {*;}
-keep class com.sun.mail.handlers.** {*;}
-keep class com.sun.mail.smtp.** {*;}
-keep class com.sun.mail.util.** {*;}
-keep class mailcap.** {*;}
-keep class mimetypes.** {*;}
-keep class myjava.awt.datatransfer.** {*;}
-keep class org.apache.harmony.awt.** {*;}
-keep class org.apache.harmony.misc.** {*;}

-dontshrink
-keep class myjava.** {*;}
-keep class org.apache.harmony.** {*;}
-keep public class Mail {*;}


#acra
#ACRA specifics
# Restore some Source file names and restore approximate line numbers in the stack traces,
# otherwise the stack traces are pretty useless
-keepattributes SourceFile,LineNumberTable

# ACRA needs "annotations" so add this...
# Note: This may already be defined in the default "proguard-android-optimize.txt"
# file in the SDK. If it is, then you don't need to duplicate it. See your
# "project.properties" file to get the path to the default "proguard-android-optimize.txt".
-keepattributes *Annotation*

# keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'.
# Note: if you are removing log messages elsewhere in this file then this isn't necessary
-keep class org.acra.ACRA {
    *;
}

# keep this around for some enums that ACRA needs
-keep class org.acra.ReportingInteractionMode {
    *;
}

-keepnames class org.acra.sender.HttpSender$** {
    *;
}

-keepnames class org.acra.ReportField {
    *;
}

# keep this otherwise it is removed by ProGuard
-keep public class org.acra.ErrorReporter{
    public void addCustomData(java.lang.String,java.lang.String);
    public void putCustomData(java.lang.String,java.lang.String);
    public void removeCustomData(java.lang.String);
}

# keep this otherwise it is removed by ProGuard
-keep public class org.acra.ErrorReporter{
    public void handleSilentException(java.lang.Throwable);
}

      

+3


source to share


1 answer


Exclude Saripaar classes from obfuscation by adding the following line to your file proguard-rules.pro

.



-keep class com.mobsandgeeks.saripaar.** {*;}

      

0


source







All Articles