Uchiha
Uchiha

Reputation: 342

Android API level 21 backward compatibility? (Since the new update of the SDK came out)

I have a problem with the API Level 21. I want to use the Material Design and still be able to run the application on lower API levels like 18 (Android 4.3.1). But I always get that error:enter image description here

My manifest SDK looks like that:

enter image description here

And the build.gradle like that: enter image description here

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

Cheers.

Upvotes: 6

Views: 2364

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363895

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

Note: The material theme is only available in Android 5.0 (API level 21) and above

This means that you have to use the values-v21 folder for your Material Theme.

However you can use the 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 info here: https://chris.banes.me/2014/10/17/appcompat-v21/

Upvotes: 8

Related Questions