2

every now and then I experience the same problem with updating the support library dependencies in the gradle file.

At the moment I use the version 26.0.0-alpha1

compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:support-core-utils:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.0.0-alpha1'

Furthermore my setup is like this

compileSdkVersion 26
buildToolsVersion '26.0.2'
minSdkVersion 21
targetSdkVersion 26

To update the repositories I use

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

Today I updated all tools and now all of the support libraries are marked with the message

A newer version of com.android.support:recyclerview-v7 than 26.0.0-alpha1 is available: 26.1.0

So I change the version of the library to 26.1.0

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

But this leads to the error

Failed to resolve: com.android.support:recyclerview-v7:26.1.0

So I change my setup to

buildToolsVersion '26.1.0'

But this leads to the error

Failed to find Build Tools revision 26.1.0
Install Build Tools 26.1.0 and sync project

So I click on "Install ..." and it leads to the error

All packages are not available for download!
The following packages are not available:
- Package id build-tools;26.1.0

It feels like Android Studio is goofing me. Can someone tell me a working way to update the libraries?

Emanuel
  • 863
  • 9
  • 29

2 Answers2

0

Update your project level build.gradle file with this one

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And your buildToolVersion should be like this : buildToolsVersion '26.0.2' or update to latest 27.0.1

Krishna Meena
  • 5,693
  • 5
  • 32
  • 44
0

Failed to resolve: com.android.support:recyclerview-v7:26.1.0

You have to add the google maven repo in your repositories block. You are adding it only in the block under the buildscript block and it is different.

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

Failed to find Build Tools revision 26.1.0

It doesn't exist. Use an existing version.
You can check here.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • 1
    Thanks for the link. It is helpful. You mentioned that 26.1.0 does not exist but why does Android Studio suggest to use version 26.1.0? That makes no sense to me / irritates me. – Emanuel Dec 03 '17 at 14:34