Skip to content

[BUG] code requires API level 27 (current min is 24) #4908

Description

@hannesa2

Actual behaviour

Image

Adding a baseline makes no sense at all. You should fix it !

Option 1: Move to values-v27/styles.xml

Split the style: keep the base in values/styles.xml (without the cutout item), add the cutout item in values-v27/styles.xml.
Pros:
Correct Android way — safe on all API levels
No suppression needed
No runtime conflicts on older devices
Cons:
Requires duplicating/splitting style across two files
More maintenance overhead

Option 2: Raise minSdkVersion to 27

Change minSdkVersion 24 → minSdkVersion 27 in build.gradle.
Pros:
Simplest change, no code split needed
Eliminates all API 24–26 lint issues
Cons:
Drops support for Android 7.x/8.0 (~5–8% of devices)
May conflict with project policy/requirements

Option 3: Add tools:targetApi="27" in XML

Add tools:targetApi="27" to the or parent <style>.
Pros:
Suppresses lint, no file splitting
Minimal change
Cons:
Doesn't prevent runtime crash if attribute conflicts on API 24–26 (manufacturer custom attrs)
Just a lint suppression — doesn't actually make the code safe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions