Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typing in build.gradle in IntelliJ Idea is slow

So, I got weird problem. I moved from Eclipse to IntelliJ Idea. And when I'm typing/editing file build.gradle it's... lagging, very hard to write anything there. What can cause that? Refreshing didn't help.

Added plugin: apply plugin: 'idea' But can't see in IntelliJ Idea tasks for idea in Gradle perspective. When I open Eclipse everythings works fine, with Gradle plugin for eclipse I can see these tasks in the project etc. the idea tasks are only available from command line, not from intellij idea gui.

But I want to fix that annoying thing with typing in build.gradle... why it is lagging?!

Please, help.

like image 953
rav3n Avatar asked Sep 24 '15 19:09

rav3n


People also ask

Why is Gradle so slow?

As our Android Studio project size increases, the gradle build performance becomes critical. The gradle speed for even the simplest project is pretty slow. Though every project comes up with it's own complexity and uniqueness which causes it to have a different build speed.

How do I refresh the Gradle cache in IntelliJ?

We can do this by: Selecting one of the suggestions in the message; Pressing on the Refresh Gradle icon in the top right, Using the keyboard shortcut ⇧⌘I (macOS), or Ctrl+Shift+O (Windows/Linux).

How disable Gradle build in IntelliJ?

Note that it requires you to have gradlew executable in the project directory (it's there by default when using Android Studio). After the installation you can find "Gradle Stop" button on Main Toolbar and inside Run Menu.


2 Answers

Been troubled by this myself recently. Was extremely slow just editing text in the build file like OP describes. Just solved it. When you've opened a project and added a build.gradle file afterwards it seems you have to "link the gradle project" for intellij to work as it should while editing this file.

One way of doing it:

  • Close Intellij if it's open.
  • When the IDE is loaded up it'll give you a notification of an unlinked gradle project. Follow the tip in that notification box and all should be well.

A second way:

  • Close the project from intellij. File -> close project.
  • In the following welcome dialogue choose to import a project.
  • Pick "import from an external model" and then select Gradle as the model. Should be working.
like image 59
knerlington Avatar answered Sep 22 '22 09:09

knerlington


The following exclusion to my save actions plugin alleviated the problem for me:build\.gradle

enter image description here

like image 31
chrisjleu Avatar answered Sep 24 '22 09:09

chrisjleu