Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

An Incompatible API Usages in APP of "<android.content.Context: int getColor(int)>" #950

Open
PSDroid2022 opened this issue Mar 1, 2022 · 0 comments

Comments

@PSDroid2022
Copy link

PSDroid2022 commented Mar 1, 2022

For your app, we have found that this project has accessed the following APIs which are available only on an API level higher than the declared minSdkVersion and which are accessed without proper protection. In other words, if those APIs get called at runtime, it will trigger a NoSuchMethodError and thus result in a crash of the running application.

<android.content.Context: int getColor(int)>: [23,30]

Error path: <com.kabouzeid.gramophone.ui.activities.SettingsActivity$SettingsFragment: boolean lambda$invalidateSettings$7$SettingsActivity$SettingsFragment(androidx.preference.Preference,java.lang.Object)>[[]]--><com.kabouzeid.gramophone.appshortcuts.DynamicShortcutManager: void <init>(android.content.Context)>[]--><com.kabouzeid.gramophone.appshortcuts.DynamicShortcutManager: void initDynamicShortcuts()>[[]]--><com.kabouzeid.gramophone.appshortcuts.DynamicShortcutManager: java.util.List getDefaultShortcuts()>[[]]--><com.kabouzeid.gramophone.appshortcuts.shortcuttype.ShuffleAllShortcutType: void <init>(android.content.Context)>[]--><com.kabouzeid.gramophone.appshortcuts.shortcuttype.ShuffleAllShortcutType: android.content.pm.ShortcutInfo getShortcutInfo()>[[]]--><com.kabouzeid.gramophone.appshortcuts.AppShortcutIconGenerator: android.graphics.drawable.Icon generateThemedIcon(android.content.Context,int)>[[]]--><com.kabouzeid.gramophone.appshortcuts.AppShortcutIconGenerator: androidx.core.graphics.drawable.IconCompat generateDefaultThemedIcon(android.content.Context,int)>[[]]--><android.content.Context: int getColor(int)>
Error path: <com.kabouzeid.gramophone.App: void <init>()>[[]]--><android.content.Context: void <init>()>[]--><android.content.Context: int getColor(int)>

You can add an if-then check like "If(Build.VERSION.SDK_INT >= 23)" when invoking this API to prevent compatibility issues.

@PSDroid2022 PSDroid2022 changed the title Some Incompatible API Usages in APP An Incompatible API Usages in APP of "<android.content.Context: int getColor(int)>" Mar 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant