Issue
To get all drawables in an android app (using Kotlin) I call R.drawable::class.java.fields
.
Since yesterday it worked perfectly fine but as I updated
classpath "com.android.tools.build:gradle:4.0.2"
to
classpath "com.android.tools.build:gradle:4.1.0"
it just returns an empty array (so no fields / drawables are found).
I changed anything other than this and also tried to clean the project, rebuild it, invalidate android studio caches and to downgrade and upgrade again, but nothing worked for me.
Why is that and is there a way to fix that weird bug?
Solution
I found a solution:
I made it working by explicitly exluding the fields out of resource shrinking by adding an entry to the proguard rules as explained here: https://github.com/mikepenz/AboutLibraries/issues/331
You just have to add the following to the proguard-rules.pro file for your app module:
-keep class **.R$* {
<fields>;
}
Answered By - ByteFanatic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.