3rd-party Gradle plug-ins may be the cause

After updating to Android Studio 3.1 I got this error message:

The project works fine and this is mostly just a warning, so my question is what's the meaning of the warning and how can I get rid of it?

The relevant parts from gradle files:

This is my project's build.gradle

buildscript {
    ext {
        kotlin_version = '1.2.31'
        anko_version = '0.10.4'
        room_version = '1.0.0'
        support_version = '27.1.0'
        firebase_version = '12.0.0'
        gms_version = '12.0.0'
    }

    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://jitpack.io" }
        maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
    }
}

And this is my app's build.gradle file:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 27
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

To solve the issue, remove Instant App Provision from the "Run Configurations" and leave only the Gradle-Aware Make.

Run -> Edit Configurations..

My Run/Debug configurations after successful build

I have AndroidStudio 3.1, Gradle Plugin 3.1.0 and Kotlin library version 1.2.30.


I restarted Android Studio and the problem disappeared.

Click File -> Invalidate Caches/Restart

Every time I change the gradle file, I must restart Android Studio to or the problem returns.

You can also try this:

  1. Re-ordered repositories to:

    mavenCentral()
    maven { url 'https://jitpack.io' }
    google()
    jcenter()
    
  2. Clearing this folder: user's ~/.gradle/caches and deleting app build folder manually, then clean and rebuild.


What fixed the issue for me:

  • Change gradle plugin version to 3.1.0
  • Change Kotlin version to 1.2.30
  • Then Android studio changed gradle wrapper to version 4.4
  • Then Android studio was saying that the build tools version used was 27.0.3 and that I should change it to 27.0.3 so I also changed the target SDK to 27
  • I added this to my gradle.build:

    kapt {
         generateStubs = true
     }
    

I hope it helps


at android studio v3.1.2 , happen Error:

Folder D:\AndroidProjects\app\build\generated\source\kaptKotlin\debug
Folder D:\AndroidProjects\app\build\generated\source\kaptKotlin\release
3rd-party Gradle plug-ins may be the cause

because dataBinding use apply plugin: 'kotlin-kapt' so add

kapt {
    generateStubs = true
}
  1. Change gradle plugin version to 3.1.2
  2. Change Kotlin version to 1.2.30
  3. Then Android studio changed gradle wrapper to version 4.4
  4. Then Android studio was saying that the build tools version used was 27.1.1 and that I should change it to 27.1.1 so I also changed the target SDK to 27