Closed PSDroid2022 closed 2 years ago
Are you certain? addButton
is a FloatingActionButton
(https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html) from the support library, not just just some View
. The main point of using these support library classes is that they provide backward compatibility for older devices.
Problems like these are typically detected at release time. The app cannot be built without completing lintVitalRelease
, which will fail with the message "NewAPI". Furthermore, these lines are regularly tested and no problem is detected; my primary test device runs api19.
What method are you using to find these problems? It seems like maybe a false positive, but I'd like to better understand.
1.It seems that FloatingActionButton.setBackgroundTintList(@Nullable ColorStateList tint) no longer changes background color because of issues ( https://code.google.com/p/android/issues/detail?id=201873). (https://stackoverflow.com/questions/31662907/setting-the-background-color-of-floatingactionbutton-with-setbackgroundtintlist)
I do understand there is a bug and that the function no longer works on newer devices.. However look at the quoted code; its a cludge that is only run for api <= 19. Those lines are working as intended. I don't see any reason to be chasing non-existent issues.
Ok, I understand , and it will be dead codes since it no longer works.
We confirm a compatibility issue which might threaten the robustness of your app and give a detailed suggestion for you.
In ''com.forrestguice.suntimeswidget.alarmclock.ui.AlarmClockActivity", you invoke the API "<android.view.View: void setBackgroundTintList(android.content.res.ColorStateList)>" in "initViews" method as shown in following. But actually, this API is introduced in API level 21( https://developer.android.google.cn/reference/android/view/View?hl=en#setBackgroundTintList(android.content.res.ColorStateList)).
So when the app try to invoke this API on devices after API level 16~19, your app will run with an unpredictable results. So we suggest you add an "if(SDK_INT >=21)" to fix this potential issue.
Android device