简体   繁体   中英

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.

Try

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM