The release version of Android Studio with proguard: can’t find referenced field in program
This is the latest hot topic for every Android professional programmer. Will you shine in the glory of wisdom?
I got a warning from the obfuscator. The Appirater class causes this warning:
can’t find referenced field in program class de.xxx.xxx.R.$id
From the Proguard website
proguard troubleshooting
A program class is referring to a field or a method that is missing
from another program class. The warning lists both the referencing
class and the missing referenced class member. Your compiled class
files are most likely inconsistent. Possibly, some class file didn’t
get recompiled properly, or some class file was left behind after its
source file was removed. Try removing all compiled class files and
rebuilding your project.
A Build –>
Clean –> Rebuild does not work.
If I add
-dontwarn
The code compiles, but the application crashes on startup.
Adding an entire proguard from the Appirater repo .cfg resulted in no success.
Solution
Try
-keepclassmembers class **. R$* {
public static <fields>;
}