The app has dependency on library, which has class members with
@SuppressWarnings("unused")
annotation. When I made use of proguard-rules.pro by,
minifyEnabled true
in gradle file, the members with above annotations are not found at runtime, with
NoSuchFieldError error.
How to keep those members from that library package, with annotation
@SuppressWarnings("unused")
, through
"proguard-rules.pro"
try using something like this for the specific class you are using:
The
@SuppressWarnings
annotation has source-level retention, thus it is not present in the actual class file that is processed by ProGuard.You will have to add specific ProGuard rules yourself to keep these fields if you need them at runtime.
To keep all fields of a class you can use a rule like this: