FloatingActionButtonSpeedDial icon indicating copy to clipboard operation
FloatingActionButtonSpeedDial copied to clipboard

Cannot resolve symbol 'colorOnSecondary'

Open PhantomLord72 opened this issue 3 years ago • 2 comments

In UiUtils, master branch

PhantomLord72 avatar Apr 12 '21 08:04 PhantomLord72

I can confirm, there is a bug in the 3.3.0 version:

java.lang.NoSuchFieldError: No static field colorOnSecondary of type I in class Lcom/leinardi/android/speeddial/R$attr; or its superclasses (declaration of 'com.leinardi.android.speeddial.R$attr' appears in /data/app/~~lgg8kaX3XpAy2wwcLYjcGA==.apk!classes2.dex)
                                                                                                    	at com.leinardi.android.speeddial.UiUtils.getOnSecondaryColor(UiUtils.java:68)
                                                                                                    	at com.leinardi.android.speeddial.FabWithLabelView.setSpeedDialActionItem(FabWithLabelView.java:166)
                                                                                                    	at com.leinardi.android.speeddial.FabWithLabelView.init(FabWithLabelView.java:291)
                                                                                                    	at com.leinardi.android.speeddial.FabWithLabelView.<init>(FabWithLabelView.java:72)
                                                                                                    	at com.leinardi.android.speeddial.SpeedDialActionItem.createFabWithLabelView(SpeedDialActionItem.java:183)
                                                                                                    	at com.leinardi.android.speeddial.SpeedDialView.addActionItem(SpeedDialView.java:374)
                                                                                                    	at com.leinardi.android.speeddial.SpeedDialView.addActionItem(SpeedDialView.java:356)
                                                                                                    	at com.leinardi.android.speeddial.SpeedDialView.addActionItem(SpeedDialView.java:343)

The UiUtils class has a missing import for R class, probably this one com.google.android.material.R.attr.colorOnSecondary.

Why this error does not appear for all projects?

I suspect, this issue appears on projects with declared android.nonTransitiveRClass=true. If this library would also use non transitive R classes, then everything would work correctly.

jksiezni avatar Mar 17 '23 18:03 jksiezni

Hi @jksiezni, thank you for your comment, I haven't done any test but I feel you are probably right regarding the nonTransitiveRClass. Unfortunately this weekend I don't have much time, if anyone else wants to jump in with a PR, it would be nice.

leinardi avatar Mar 18 '23 08:03 leinardi