Home » Android » Please explain gradle dependancies vs min build sdk

Please explain gradle dependancies vs min build sdk

Posted by: admin November 1, 2017 Leave a comment


Android beginner here…

I’m getting all sort of rendering errors, and eventually concluded it’s got something to do with my gradle dependencies.

Now I found a nice tutorial which I’ve been following, http://www.android4devs.com/2015/06/navigation-view-material-design-support.html but I’m running to a problem extending it further, and there is something I don’t think I understand.

Should I not be using the latest stable version of any library I can? Surely these libraries are backwards compatible?

If I am supposed to use the older version of library, to match the compile sdk (which I understand to mean I’m compiling for backwards compatibility, and supporting, say, lollipop API 21-22) then:

  1. I would need a place to see a complete list of all versions of all libraries (which I cannot find), and
  2. I would not be able to use new features like RecyclerView which only came in at Marshmallow API 23.

Am I missing something?

build.gradle (module app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.example.myFirstApp"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:design:26.1.0'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.intuit.sdp:sdp-android:1.0.3'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'

Error message

The support library should not use a different version (26) than the compile sdk version (22).


You are using

compileSdkVersion 22


compile 'com.android.support:appcompat-v7:26.1.0'

error you are getting is because you are using compat version 26 while compileSdkversion is 22

You should update to compileSdkVersion to 26 and android studio will download required files so that your error will be removed. If you cannot update your compilesdk version to 26. Then change support library version to 22.2.1

compile 'com.android.support:appcompat-v7:22.2.1'

Got list of support libraries from link