Home » Android » android – Project isn't linked with Gradle

android – Project isn't linked with Gradle

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m trying to run google firebase example but got an “Project isn’t linked with Gradle” error when opens gradle file. Also files visible only in “project-veiw”. It looks it because projet use gradle.kts. How i need to set it up to make project working?

enter image description here

How to&Answers:

I had similar issue.

I have Added empty build.gradle file in the root of the project that uses Gradle Kotlin DSL (projects may use build.gradle.kts for config, however empty build.gradle file is required by grade to function correctly)

Update:

You should also add this line to settings.gradle.kts file:

rootProject.buildFileName = "build.gradle.kts"

Answer:

Right click on build.gradle.kts > Import Gradle project should help.
No need to add empty build.gradle nor set rootProject.buildFileName.