Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use the latest support library (Getting failed to resolve error with support library 26.0.2 and compileSDKVersion 26)? [duplicate]

I have updated my compileSdkVersion to 26. This is how my gradle file looks now.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId ##############
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    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:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    testCompile 'junit:junit:4.12'
}

Predictably, I get warnings for the mismatch(?) in the versions of support library (25.3.1) and the CompileSdkVersion (26).

I have tried to update the support library version to the below versions:

  • compile 'com.android.support:appcompat-v7:26.0.0'
  • compile 'com.android.support:appcompat-v7:26.0.2'

The Problem

None of them worked. Both cases show Failed to resolve errors. Clicking on Install Repository and sync project freezes Android Studio for a couple of seconds and nothing else happens.

Am I missing something?

The latest Android support version library here is 26.0.2.

like image 659
Ajil O. Avatar asked Sep 05 '17 06:09

Ajil O.


People also ask

What is support library in Android?

The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level.

How do I update my Android library?

Update the Android Support LibraryIn Android Studio, click the SDK Manager icon from the menu bar, launch standalone SDK Manager, select Android Support Repository and click “Install x packages” to update it. Note you will see both Android Support Repository and Android Support Library listed in the SDK Manager.

What is v7 support library?

v7 mediarouter library The library includes APIs for publishing app-specific media route providers, for discovering and selecting destination devices, for checking media status, and more. For detailed information about the v7 mediarouter library APIs, see the android. support. v7. media package in the API reference.


1 Answers

You should add this in your App Level build.gradle section.

Finally

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

Then Clean-Rebuild and Run .

FYI

If you're using a version of Gradle higher than 4.1, you must use :

allprojects {
      repositories {  
        google()

    }
}
like image 59
IntelliJ Amiya Avatar answered Oct 03 '22 18:10

IntelliJ Amiya