zeiteisen
zeiteisen

Reputation: 7168

Android Studio release build with proguard: can't find referenced field in program

this is the newest hot issue for every android pro coder. Will you shine in the glory of wisdom?

I got a warning from proguard. The class Appirater cause 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 is not working.

If I add

-dontwarn

the code compiles but the app crashes on startup.

To add the whole proguard.cfg from the Appirater repo leads to no success.

Upvotes: 3

Views: 2597

Answers (1)

williamj949
williamj949

Reputation: 11316

Try

-keepclassmembers class **.R$* {
    public static <fields>;
}

Upvotes: 6

Related Questions