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..
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:
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.
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
}
Change gradle plugin version to 3.1.2
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.1.1 and that I should change it to 27.1.1 so I also changed the target SDK to 27
Here are some steps that I've followed. In my case it's fixed the issue!
Platform modules targeting Android
The update of the experimental multiplatform projects feature introduces support for Android platform modules. These modules should apply the corresponding plugin in the Gradle build script and can use the shared code from a common module:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-platform-android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
// ...
// ...
Kapt diagnostic locations
As of now, kapt, the Kotlin annotation processing tool, can offer links to locations in the original Kotlin code rather than generated Java stubs as it reports errors encountered during annotation processing. You can enable this feature by adding these lines to the Gradle build script (build.gradle):
kapt {
mapDiagnosticLocations = true
}
Add this:
allprojects {
repositories {
jcenter()
google()
}
}
Don't forget the next:
// Architecture Component - Room
implementation "android.arch.persistence.room:runtime:1.1.0-beta1"
kapt "android.arch.persistence.room:compiler:1.1.0-beta1"
// Lifecyles, LiveData and ViewModel
kapt 'com.android.databinding:compiler:3.1.0'
// ViewModel and LiveData
implementation "android.arch.lifecycle:extensions:1.1.1"
// alternatively, just ViewModel
implementation "android.arch.lifecycle:viewmodel:1.1.1"
// alternatively, just LiveData
implementation "android.arch.lifecycle:livedata:1.1.1"
kapt "android.arch.lifecycle:compiler:1.1.1"
// Room (use 1.1.0-beta1 for latest beta)
implementation "android.arch.persistence.room:runtime:1.0.0"
kapt "android.arch.persistence.room:compiler:1.0.0"
// Paging
implementation "android.arch.paging:runtime:1.0.0-alpha7"
// Test helpers for LiveData
testImplementation "android.arch.core:core-testing:1.1.1"
// Test helpers for Room
testImplementation "android.arch.persistence.room:testing:1.0.0"
Clean your project
Build and That's it!
Add all of this, Clean your project, build and That's it! :) Let me know if this works! (If it is not working for you, I will help you with another solution)
More Info: Android Site
:) Let me know if it works! (If it does not work, I will
try to help you finding a better way)
If you give a downVote explain why
What actually helped for me is adding this
kapt {
generateStubs = true
}
into build.gradle
Try removing Instant run from settings and gradle will good to go.
It worked for me.
Here are some steps that i have followed and it's fixed the issue in my case.
First of all install kotlin plugin version to '1.2.31' and update it in build.gradle file like below.
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.
In my case none of the above solutions solved my problem, I was using 1.2.50 Kotlin version without any mention to Instant Run, and the build wasn't generating the Dagger classes, so I find out this question that solved my issue, apparently, in my situation it's an issue related to the new Kotlin version, so I downgraded to version 1.2.41 and worked fine.
By the way, I just tracked to that point because I used the Toggle View on Build screen.
1:Select the Toggle View and build your project
2:You're going to be able to see exactly what happened
Stackoverflow question:
Kotlin 1.2.50 asks for baseFeatureInfoDir
Issue tracker:
https://issuetracker.google.com/issues/110198434
remove apply plugin: 'kotlin-kapt'
add mavenCentral() in build.gradle like:
allprojects {
repositories {
mavenCentral()
google()
jcenter() } }
Sync and Clean project
Here is the some approach how I fix this issue for my case:
First of all update your android gradle plugin version from project build gradle file and then update your gradle version from gradle properties.
Finally update your kotlin version(Mandatory) to kotlin_version = '1.2.30' or later from project build gradle file.
Now try to clean your project and build. Issue should be resolved.
Each time after build if you build again then probably issue will occur again so, just clean your project again and then build.
This happens because the Kapt annotation processor uses this directory to store Kotlin generated files. Android currently does not recognize the path by default.
See Further Details
Adding another answer for those who could not remove Instant App Provision, because it keeps reappearing.
Build the project manually: ./gradlew assembleDebug
It is a hotfix, but it will work (because the issue is probably related to Android Studio).
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.
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
Actually,I was also facing the same error.
What i did is updating my kotlin version to the latest.
This may resolve Your problem.
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.
Related
I'm trying to manage my dependencies in Android Studio and it cannot resolve the Kotlin gradle plugin. I've tried manually adding it to my build.gradle using the code from Maven Central and adding it using the project structure feature in Android Studio.
As far as I know everything here is correct, so it should just download it and build.
(project) plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0-RC2' apply false
id 'org.jetbrains.kotlin.kapt' version '1.7.0-RC' apply false
}
---
(app) plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
---
//Kotlin dependencies (app)
implementation 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.7.0-RC'
implementation 'org.jetbrains.kotlin.kapt:org.jetbrains.kotlin.kapt.gradle.plugin:1.7.0-RC'
implementation 'com.google.devtools.ksp:symbol-processing-gradle-plugin:1.7.0-RC-1.0.5'
implementation 'org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.7.0-RC'
implementation 'androidx.test:core-ktx:1.4.0'
implementation 'androidx.test.ext:junit-ktx:1.1.3'
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0-RC2'
The details from the failed build are
The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.2.0'. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0-RC2:
I'm rather inexperienced in android development, as I'm still a student and I've been thrown into a android app project by my school even though i haven't done the relevant classes. It's completely possible I'm doing something really obviously incorrect, but I can't identify it at my current skill level
How do I resolve this? Help would be greatly appreciated as my deadline is coming up soon and I've spent all day on this
Remove implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0-RC2' line from the app dependencies and there is no need id 'org.jetbrains.kotlin.kapt' version '1.7.0-RC' apply false in the project plugins
To solve these problems, my first suggestion to you is to update the Android version to the latest available version (Stable version today is Android Studio Chipmunk), and if the project is new, let Android Studio set and create all the gradle values for you by default from the beginning.
I'm a begginer too and this resolved for me
Open build.graddle (project) find dependecies and look for this line:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0-RC2" (or other plugin version)
Replace with:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin"
in build.gradle (project) replace
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
with
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version".
And it working
Open build.graddle (project) find buildscript and look for version_kotlin and copy version number
then Open build.graddle (project) again and find dependecies and look for this line:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0" (or other plugin version)
Replace replace the version number with that copied
After couple of months of not working on my app I have decided to continue and before doing so I wanted to update all dependencies, libraries etc.
After 3h+ of a nightmare with googles nonsense I am at the final (probably not even close) stage.
This error of:
The Android Gradle plugin supports only Crashlytics Gradle plugin
version 1.25.4 and higher.
Is driving me nuts. I did a global search on my project of 1.25.4 and 1 result came up which was for the classpath 'io.fabric.tools:gradle:1.25.1' so I changed it to classpath 'io.fabric.tools:gradle:1.25.4' and hoped for the best.. But the same error keeps coming up every time I am trying to build the app..
Can anyone tell me what kind of magic potion should I spray this gradle so it actually starts to work?
add this to the root project's build.gradle:
buildscript {
repositories {
...
maven { url "https://maven.fabric.io/public" }
}
dependencies {
...
classpath "io.fabric.tools:gradle:1.26.1"
}
}
and this on top of the module level's build.gradle:
apply plugin: "io.fabric"
I just updated to Android Studio 3.0 and I'm getting this error with an existing project:
Kotlin not configured
When I go to Tools>Kotlin>Configure Kotlin in Project, I get an error saying "no configurators available". Also get the error below with the red java:
I've also tried:
Restarting
Clean and Rebuild
Invalidate caches/restart.
I first tried with invalidate cache/ restart option but it doesn't help me.
When I updated Kotlin to 1.1.60 in project's gradle file, problem is solved.
Also, use this in app's gradle for stdlib
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.1.60"
instead of
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.60"
In Android Studio, click on File -> Invalidate Caches / Restart... , then select "Invalidated and Restart". This solved my problem.
This error also occurs if you have the mavenCentral() repository missing in allprojects.
Your build.gradle (:app) should contain at least this:
allprojects {
repositories {
google()
mavenCentral()
}
}
jcenter() would work as well (for now), but that repository reached end-of-life and shouldn't be used any more.
Closing and restarting Android Studio works for me in that case. Important is that there are no other projects opened in Android Studio before you close it. I suspect that closing Android Studio with multiple opened project windows sometimes messes up the configuration especially after plugin upgrades etc.
Important Update
You should check JDK version before setting config
Kotlin gradle config page has detailed information about this.
Step 1
Check kotlin version in project level gradle file.
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
For kotlin_version '1.2.x' Use jdk NOT jre
Step 2
Check JDK version in File > Project Structure
Or check in build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
If no JDK version is set in Project Structure, then choose by Android Studio version
JDK version is 1.7 for Android Studio Version < 2.2.1
JDK version is 1.8 for Android Studio Version < 2.2.1
Because Android Studio is bundled with jdk 1.8 since 2.2.1 version.
You have 3 options of kotlin stdlib, choose according JDK version
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" //jdk_version == 1.8
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" //jdk_version == 1.7
implementation"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // jdk_version is < 1.7
if kotlin version is'1.1.x' Use jre NOT jdk
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" // or jre8
Update Kotlin Version?
You can update Kotlin version from Tools > Kotlin > Configure Kotlin Updates
Kotlin-stdlib-jre7 is deprecated since 1.2.0 and should be replaced with kotlin-stdlib-jdk7
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
I have faced this issue recently... when I updated to Android Studio 3.1 .
I did a few things to fix this.
First I updated the Kotlin version in my app gradle file and added
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.2.31"
in my app gradle file. But this alone didn't fix it.
Then uninstalled the kotlin plugin from settings, restarted Android Studio and installed it again.
EDIT :
This is my project gradle file
buildscript {
ext.kotlin_version = '1.2.31'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.31"
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
}
And this is my app gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
...
}
buildTypes {
...
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
kapt { generateStubs = true }
}
repositories {
...
}
dependencies {
...
...
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.2.31"
...
...
}
apply plugin: 'com.google.gms.google-services'
just delete .idea folder from project,and run android studio again, it will resolve KOTLIN NOT CONFIGURED issue.
A common reason of the "Kotlin Not Configured" message is an internal Android Studio exception due to a bad plugin.
In order to fix that you should disable the bad plugin.
When such plugin crash occurs, on the "Wellcome screen" you'll see a small notification (see illustration image) where you can click it and disable the bad plugin:
None of the other solutions solved my problem. I ended up figuring out that the problem lied in the google services version. Just update it to the latest.
Top level gradle at dependencies:
classpath 'com.google.gms:google-services:4.1.0'
In my case, after the update of Android Studio and plugins, I could create new projects, but my old projects were having "Gradle Sync Issues".
The solution was in File/Project Structure.../App/Dependencies:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
And then I just updated the Kotlin version in my project build.gradle:
From:
ext.kotlin_version = '1.2.30'
To:
ext.kotlin_version = '1.3.21'
Then I tried Sync again.
Obs: You can check your Kotlin version in Tools/Kotlin/Configure Kotlin Plugin Updates
I have tried all above solutions but non of them works for me.
Then finally I got success with below solution, so it may helpful for some one like me.
Delele all .iml files (in root project, libraries and modules)
Rebuild project
In my case I had to update Android studio from version 3.4.1. to 3.5 and it resolved the kotlin not configured error.
Delete .AndroidStudio3.6 folder in C:\Users\Username and re-open Android studio works for me
The only fix for me was adding
apply plugin: 'kotlin-android-extensions'
in build.gradle (:app)
One other point to check is version of your Gradle in gradle-wrapper.properties, if you use one.
Make sure that
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Has version 4.1 or higher.
You may also have the following in your build.gradle:
task wrapper(type: Wrapper) {
gradleVersion = '4.1'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
Where Gradle version is lower that 4.1
Though I see that the question already has answers that work, one might also try the following solution.
Right click on the file name (Main.kt) -> Run 'Main.kt'.
This will download a gradle file from the gradle.org website.
Wait for it to unzip. The errors were cleared.
In my case, it was a broken update of one of the plugins I've used. Check your error logs from Android Studio this will lead you to what is the problem.
Simply Create a new Activity and select its language to kotlin Android studio Automatically configured kotlin for you.
In gradle I do not use dynamic versions because that could lead to indeterminate builds.
So I state my dependencies like so:
compile 'com.squareup.okhttp:okhttp:2.2.0'
However, how do I find out if there is a new version available and what its number is?
You can use a gradle-versions-plugin to do it. This plugin provides a dependencyUpdates task, which
Displays a report of the project dependencies that are up-to-date, exceed the latest version found, have upgrades, or failed to be resolved.
All you need to do, is to apply, by configuration of build.script dependencies, as:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
// classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5' // uncomment if you're using Gradle 1.x
}
}
And applying the plugin itself, with:
apply plugin: 'com.github.ben-manes.versions'
You could use this site to search your library latest version.
I have created Android library as Android Studio module. Added as dependency to my root module. While coding I can import any class from library package but while I'm trying run the application I'm getting an error package some.mylibrary.project does not exist.
build.gradle root module
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:5.+'
compile project(':libraries:mylibrary')
}
android {
compileSdkVersion 17
buildToolsVersion "20.0.0"
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
abortOnError false
}
***
}
build.gradle library module
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'idea'
android {
compileSdkVersion 17
buildToolsVersion "20.0.0"
*****
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
settings.gradle
include ':libraries:mylibrary'
P.S. I have to mention that the project was exported from Eclipse IDE so the project structure is different from default one.
For Android Studio 2.2.2
Yes, in library module, it can't use the apply plugin: com.android.application statement in the module definition, yes, use apply plugin: com.android.library instead. (still in lib module)
But then you have to do the following:
Expose the same SDK versions in Gradle files for both modules.
Right click on your projects "app" module folder and click on -> open module settings
Click on the "dependencies" tab
Click on the + sign to add a new dependency and select "Module Dependency"
Look for the library you need and add it.
Also while naming your lib module avoid capitals.
If you have a library module, it can't use the apply plugin: 'com.android.application' statement in the module definition, or the build will silently fail as you're seeing. use apply plugin: 'com.android.library' instead.
A bug has been filed to request that the build system fail loudly instead of silently when this happens: https://code.google.com/p/android/issues/detail?id=76725
The answer above is somewhat lacking
If you project java add in Kotlin getting get this error
Tools Tab Kotlin and Configure Kotlin
(Select Android with Gradle) after select with Modules
Project build.gradle add
ext.kotlin_version = ‘1.3.21’
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Apps build.gradle
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Referance : https://medium.com/mindorks/enabling-kotlin-support-for-a-current-only-java-android-project-98c75e04384a
This error happens when you change the package name and try to run the code. this occurs because the android studio still has the cache of your package with an old name.
Also, cross-check all the imports as well as an imported package in your code so that no different package name exists. For example, is common this error is referring to another imported file near where the error is occurring. Check previous imports near.
To fix this error you can try to do an 'invalidate caches / Restart' option from the File menu in android studio. Choose “Invalidate and restart option” and close Android Studio.
Another reason for this error, is when one changes the project's path root folder or in any of the modules it depends. In this particular case, to fix this error you need to remove the affected modules, and re-add them again. Next don't forget to do an 'invalidate caches / Restart' option from the File menu in android studio. Choose “Invalidate and restart option” and close Android Studio.
Clean your project from android studio :
“Build -> Clean Project”. This will clear your build folders.
Remove your .gradle directory from the root of your project. It contains some Gradle cache files.
Delete also the .idea directory (make a backup before). It contains some project configuration files.
Restart Android Studio.
Finally
if the error still persists, you need to move the affected files to an external directory of the project's root folder. And on Android Studio, create manually each filename as previous, and copy the code inside from the old file. This will defiantly solve this error.
In build-gradle app, add this row:
implementation project(":your_name_library_here")
If you are facing this issue while using Kotlin and have
kotlin.incremental=true
kapt.incremental.apt=true
in the gradle.properties, then you need to remove this temporarily to fix the build.
After the successful build, you can again add these properties to speed up the build time while using Kotlin.
Reference: https://stackoverflow.com/a/58951797/3948854