API Compatibility API Level 21 API? (Since there is a new SDK update)

I have a problem with API level 21. I want to use Material Design and still be able to run the application at lower API levels, such as 18 (Android 4.3.1). But I always get this error: enter image description here

My SDK manifest looks like this:

enter image description here

And build.gradle like this: enter image description here

Hope this is enougth information, to get some help, I really need it :(

Greetings.

+6
source share
1 answer

As described in the document: https://developer.android.com/training/material/theme.html

Note. Material theme is only available in Android 5.0 (API level 21) and higher.

This means that you should use the values-v21 folder for your material theme.

However, you can use v7 Support Libraries to provide themes with material design styles for some widgets. This is an example using the AppCompat theme.

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light"> <!-- Here we setting appcompat's actionBarStyle --> <item name="actionBarStyle">@style/MyActionBarStyle</item> <!-- ...and here we setting appcompat's color theming attrs --> <item name="colorPrimary">@color/my_awesome_red</item> <item name="colorPrimaryDark">@color/my_awesome_darker_red</item> <!-- The rest of your attributes --> </style> 

More details here: https://chris.banes.me/2014/10/17/appcompat-v21/

+8
source

Source: https://habr.com/ru/post/976902/


All Articles