Avijit Karmakar
Avijit Karmakar

Reputation: 9388

AppCompat & Support library version for SDK Platform 26

I have already installed Android SDK Platform 26, Android SDK Tools 26.0.2

enter image description here

This is my app level build.gradle file.

build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.0'
    defaultConfig {
        ...
        minSdkVersion 15
        targetSdkVersion 26
        ...
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.2'
    compile 'com.android.support:support-v4:26.0.2'
    testCompile 'junit:junit:4.12'
}

I can't sync the gradle. I am getting these errors:

Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.2
Error:(27, 13) Failed to resolve: com.android.support:support-v4:26.0.2

Are the appcompat and support library versions are wrong?

How can I solve this issue? Please help.

Thanks in advance.

Upvotes: 12

Views: 23004

Answers (2)

Dad
Dad

Reputation: 1

appcompat version must to match with SdkVersion. Try this one

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

Upvotes: -2

zeekhuge
zeekhuge

Reputation: 1594

There are two things to it

First

This is the page that announces recent releases of the support library, and I don't see 26.0.2 version. The latest is 26.0.0-beta2 and Note that 26.0.0-beta2 is a pre-release version

Second

Make sure you have google's maven repository included in you project's gradle file. Something like :

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

Upvotes: 36

Related Questions