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 meani
Well, I found it is because of apply plugin: 'kotlin-kapt'
,if you delete this line in build.gradle(app), then you will build successfully...
Have no idea why this plugin results in these warnings.
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:
Re-ordered repositories to:
mavenCentral()
maven { url 'https://jitpack.io' }
google()
jcenter()
Clearing this folder: user's ~/.gradle/caches and deleting app build folder manually, then clean and rebuild.
Configuration on demand with Gradle 4.6 and above: If you're using Android Gradle Plugin 3.0.x or 3.1.x with Gradle 4.6 and above, you should disable configuration on demand to avoid some unpredictable build errors. (If you are using Android Gradle Plugin 3.2.0 or higher, you do not need to take any action to disable configuration on demand.)
Disable configuration on demand in your gradle.properties file as shown below:
org.gradle.configureondemand=false To disable configuration on demand in the Android Studio settings, choose File > Settings (Android Studio
Preferences on Mac), select the Compiler category in the left pane, and clear the Configure on demand checkbox.
In Android Studio 3.2 Beta 1 and higher, the options for enabling configuration on demand have been removed. Please read known issues section from below link. enter link description here
Here are some steps that i have followed and it's fixed the issue in my case.
dependencies { classpath 'com.android.tools.build:gradle:3.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$1.2.31" }
Clean Project.
Finally Rebuild the project.
I had this issue when using Realm with kotlin in android studio.
To solve follow these steps :
After adding Realm to project build.gradle, Make sure your app build.gradle file is like this:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
.
.
.
androidExtensions {
experimental = true
}
Use kapt
instead of annotationProcessor
in your app build.gradle dependencies.
Go to Run -> Edit Configurations..
and remove Instant App Provision
option.
Run this command in Android studio's terminal :
gradlew assembleDebug
It's OK !
Note: If you see "3rd-party Gradle plug-ins may be the cause" message again, Do step 3 & 4 again.
What fixed the issue for me:
3.1.0
1.2.30
4.4
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