1

I've just installed Android Studio for windows, I've created a simple android project with a blank activity without modifying it and I got these errors:

C:\Users\Task\AndroidStudioProjects\MyApplication\app\build.gradle

Error:(23, 24) Failed to resolve: com.android.support.test.espresso:espresso-core:2.0 Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:26.+

Gradle Sync Issues

Error:The SDK Build Tools revision (23.0.2) is too low for project ':app'. Minimum required is 25.0.0

I didn't touch anything, every project I create gives me this error, if someone knows what's the problem I would be very grateful for a help, thanks to everyone.

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
Federico Taschin
  • 2,027
  • 3
  • 15
  • 28
  • For the support libraries check https://stackoverflow.com/questions/45103230/failed-to-resolve-com-android-supportcardview-v726-0-0-android/45342389#45342389. For the Build Tools just update your SDK Manager and your build.gradle file. – Gabriele Mariotti Oct 08 '17 at 07:10

3 Answers3

1

The problems probably related with outdated project template in the Android Studio. You can solve the problems by following the description below.

The first problem:

Error:(23, 24) Failed to resolve: com.android.support.test.espresso:espresso-core:2.0 Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:26.+

is related with support library 26 with google maven. Quoting my answer from https://stackoverflow.com/a/45876864/4758255:


Please be noted that to use support library starting from revision 25.4.0, we need to add google maven. As in the release note says:

Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.

Read more at Support Library Setup.

Play services and Firebase dependencies since version 11.2.0 are also need google maven. Read Some Updates to Apps Using Google Play services and Google APIs Android August 2017 - version 11.2.0 Release note.

So you need to add the google maven to your root build.gradle like this:

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

For Gradle build tools plugin version 3.0.0, you can use google() repository (more at Migrate to Android Plugin for Gradle 3.0.0):

allprojects {
    repositories {
        jcenter()
        google()
    }
}

The second problem:

Error:The SDK Build Tools revision (23.0.2) is too low for project ':app'. Minimum required is 25.0.0

means that you need to use minimum build tools version 25. To solve it, first check your root build.gradle. It should be contain something like:

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

Second, check your App build.gradle. It should be contain minimum buildToolsVersion 25:

android {
  compileSdkVersion 25
  buildToolsVersion "25.0.3" // here the builToolsVersion.
  defaultConfig {
    applicationId "com.example.project"
    minSdkVersion 9
    targetSdkVersion 25

    ...
  }
  ..
}
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
  • Thank you very much, it works now! But every time I create a new project i have to fix it, how can i set that as default? – Federico Taschin Oct 07 '17 at 17:12
  • And i forgot the last problem, Android studio shows me an error on the package of the main activity: "The SDK platform-tools version (23.0.1) is too old to check APIs compiled with API 26; please update" – Federico Taschin Oct 07 '17 at 17:21
  • You need to update it from SDK Manager in Android Studio. It looks like your Android Studio is too old. What is your Android Studio version? The latest version is 2.3.3 – ישו אוהב אותך Oct 08 '17 at 04:11
  • Ok, I fixed everything except the fact that every new project i have to add "maven { url "https://maven.google.com" }" to the gradle file. My Android Studio version is 2.3.3 – Federico Taschin Oct 08 '17 at 15:33
  • I also use the same version. The template didn't include `maven { url "maven.google.com"; }` for the project. We need to add it manually for the support library 25.4.0 above and for firebase/google play service. Congratulations then ;) – ישו אוהב אותך Oct 09 '17 at 05:37
0

Go to sdk manager >> android sdk >> sdk tools and check everything then click apply

Should be fixed after that

Moshe Edri
  • 244
  • 2
  • 10
0

In SDK Manager, you must update SDK Build Tools to the minimum required

Jean Noel
  • 947
  • 9
  • 7