I have converted one of our Android projects from the old Groovy settings.gradle
and build.gradle
files to the new Kotlin DSL, i. e. settings.gradle.kts
and build.gradle.kts
.
While "it works on my machine" - in particular: the original project I converted from Groovy to Kotlin works fine in its original directory - all my co-workers are unable to open the project when they clone the repo. Importantly, neither can I open the project myself (with the same AS installation on the same machine) when I clone the repo to some other directory. So, I suspect there is some additional detail missing in some configuration file but I cannot seem to figure out which...
Details:
File > Open...
and then select the project folder, I only get the error message "The project 'xxx' is not a Gradle-based project"Import Project (Gradle, Eclipse ADT, etc.)
and then select Import project from external model
and Android Gradle
Android Studio will create an empty build.gradle
file and fail with the error message "ERROR: Plugin with id 'com.android.library' not found." Deleting the build.gradle
just goes back to the error message I described in the first bullet point.I am aware of this Github issue, which seems to describe the same problem, but it's been very quiet and I thought someone around here must have figured out a solution to this...
Oh, command line builds work everywhere - this is purely an Android Studio problem.
UPDATE: When I copy the whole project to a new folder (instead of cloning the repository) I can open it without any problems. So, am I correct in assuming that there must be something inside the folder - but not in Git - that makes it work?
I was able to 'fix' it by deleting the .idea
directory and reopening the project. The .idea
directory is usually not committed in git but I guess copying the directory invalidates the directory structures in the files within the .idea directory.
The whole bug is easily reproducible when you click on File
> Re-import Gradle project
.