1

I use android studio and I want to use material design features in API lower than 21. First of all I read these questions:

how to use material design features in api lower than 21 in eclipse?

I want Material Design in Pre 5.0 device in eclipse

Android Design Support Library And Material Design Backwards Compatibility?

And also I read these:

https://developer.android.com/training/material/compatibility.html

https://developer.android.com/tools/support-library/features.html#v7-appcompat

Also I used this tutorial to create a compatible material design project:

http://www.androidhive.info/2015/04/android-getting-started-with-material-design/

I added this library: com.android.support:appcompat-v7:21.0.0 and i used material themes like the previous link but I couldn't see any material feature in my android 4.2.2. As I find out from google developer it uses compatibility to show material feature in API 21 and it still works without material feature in android lower than 21. So how can I use material features for android lower than 21?

My gradle is like this :

    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "test.parsoa.com.newmaterial"
        minSdkVersion 17
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:appcompat-v7:21.0.0"
}
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Taher
  • 1,185
  • 3
  • 18
  • 36

1 Answers1

0

At first update your dependencies like :

dependencies {
    compile "com.android.support:appcompat-v7:22.2.1"
    compile 'com.android.support:design:22.2.1'  // with this dependency you can use material design components pre api 21 
}

Just take a look at http://android-developers.blogspot.de/2015/05/android-design-support-library.html

eddykordo
  • 607
  • 5
  • 14
  • It gives error like this > Could not resolve all dependencies for configuration ':app:_debugCompile'. > Could not find com.android.support:design:22.2.1. Should I download this library too? – Taher Jul 28 '15 at 08:28
  • Update your sdk to the newest version with the sdk manager , and than update your compileSdkVersion to 22 buildToolsVersion to "22.0.1" and targetSdkVersion 22 – eddykordo Jul 28 '15 at 08:32