Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

could not find extension implementation class org.jetbrains.kotlin.idea.scripting.gradle.roots.GradleBuildRootsManager

My project works and builds successfully on my Mac but I cloned from github and although Android Studio appears to work normally, the project wouldn't build. I setup this project using Kotlin DSL.

Gradle sync failed: could not find extension implementation class org.jetbrains.kotlin.idea.scripting.gradle.roots.GradleBuildRoot

Tried invalidate cache, removed all .gitignore rules but it's still the same. Any ideas?

like image 305
Mbuodile Obiosio Avatar asked Dec 20 '20 01:12

Mbuodile Obiosio


2 Answers

I had the same issue (Note : Running Linux/Ubuntu 20.04 LTS and Android Studio 4.1.1).

Things I tried that did NOT work and error persisted :

  • Invalidate Caches / Restart
  • Reboot
  • Nuking the .gradle and .m2 folders
  • Android Studio re-install
  • Downgrade kotlin gradle plugin from 1.4.21 to 1.4.10

What did work :

  • Moving the project to a different folder/location on disk and open Android Studio

As soon as I moved the project back to the original location I would start getting the same error. This lead me to believe it was some sort of caching issue, separate from the caches "invalidated".

Solution :

Android Studio / Intellij creates a hidden folder called :

On Linux :

AS : ~/.cache/Google/AndroidStudioX.X

IJ : ~/.cache/Jetbrains/IntelliJIdea2020.X

On Mac :

AS : ~/Library/Caches/Google/AndroidStudioX.X

IJ : ~/Library/Caches/Jetbrains/IntelliJIdea2020.X

On Windows:

AS : %HOME%\AppData\Local\Google\AndroidStudioX.X

IJ : %HOME%\AppData\Local\Jetbrains\IntelliJIdea2020.X

Inside this folder are other various folders, however I removed the relevant workspace file (workspace/[project name].[hashed value].xml) after which problem went away when opening the project again, from its original location.

So it appears that "Invalidate Caches / Restart" does not "Invalidate" all caches!

I hope this resolves you problem!

Update

As this answer has had quite a few upvotes it would appear that this might be a ongoing bug with Intellij. If anyone has this problem, before resolving with the suggested solution consider checking there isn't an open issue on the bug tracker and submitting a new issue : https://youtrack.jetbrains.com/issues

Feel free to edit this update with issue if one is opened.

Update 2

Issue opened by @GeniusRUS :

https://youtrack.jetbrains.com/issue/KT-44937

like image 111
Mark Avatar answered Oct 09 '22 17:10

Mark


For Mac users delete the following file:

~/Library/Caches/Google/AndroidStudio4.1/workspace/<your_project_name>.58dfbe93.xml

PS: Thanls @Mark Keen for solution.

like image 23
amatkivskiy Avatar answered Oct 09 '22 18:10

amatkivskiy