Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 901
Avijit Karmakar Avatar asked Jul 21 '17 19:07

Avijit Karmakar


People also ask

What does Appcompat mean?

426. An Android support library that enables the use of the ActionBar and Material Design specific implementations such as Toolbar for older devices down to Android v2.

Why is AppCompatActivity used?

AppCompatActivity is the new way to go because the ActionBar is not encouraged anymore and you should use Toolbar instead (that's currently the ActionBar replacement). AppCompatActivity inherits from FragmentActivity so if you need to handle Fragments you can (via the Fragment Manager).


1 Answers

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"
        }
    }
}
like image 163
zeekhuge Avatar answered Oct 14 '22 09:10

zeekhuge