The sdk platform-tools version (26.0.2) is too old to check APIs compiled with API 27; please update

zed picture zed · Nov 8, 2017 · Viewed 7.4k times · Source

I'm using IntelliJ Idea Community Edition 2017.2.5 and am building an Android app.

My problem is that even if in my app (Gradle) I have:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.0"
    defaultConfig {
        applicationId "com.app.mtvtr"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}
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:27.0.0'
    compile 'com.android.support:design:27.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
    compile 'com.android.support:support-v4:27.0.0'
    testCompile 'junit:junit:4.12'
}

Also, on first build of the project, compile for the appcompat, design and support was set to 27+ (which IMHO is bad practice and is already pointed by the Studio as a bad idea), so using which tools that I have, I have set it to 27.0.1, and later to 27.0.0 just for the testing if it might work..

In my Fragments and Activities I have:

Package-code

And the warning says:

The sdk platform-tools version (26.0.2) is too old to check APIs compiled with API 27; please update

Now, I know that there are topics on SO regarding old and new versions, but I have (to my belief) set the Gradle properly and I am nowhere using platform-tools version 26 or even 26.0.2...

I have tried Restarting and invalidating caches three times.

The project properly builds onto the device and everything works. But, of course, I want to fix the warning. (And not hide it like some would suggest..)

Two things that come to mind are:

  1. I missed somewhere that I should have updated the version, maybe?
  2. I need to start a new project from scratch.

Any ideas? :)

Answer

anthonymonori picture anthonymonori · Nov 21, 2017

Android Studio 3.0 will be merged into IntelliJ IDEA 2017.3 version, which will make the com.android.tools.build:gradle:3.0.0 plugin compatible with it. That will make this error to go away.

For those of you who are experiencing this issue in Android Studio, check your root build.gradle file and make sure it is updated to the above mentioned plugin version (3.0.0), in order to be able to compile against API 27 with the current latest build tools (26.0.2).

You may consequently also have to update the Gradle wrapper to the latest (4.1 at the time of this answer).