rav3n
rav3n

Reputation: 171

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.

Upvotes: 15

Views: 6306

Answers (3)

chrisjleu
chrisjleu

Reputation: 4380

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

enter image description here

Upvotes: 3

knerlington
knerlington

Reputation: 63

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.

Upvotes: 6

TheLuminor
TheLuminor

Reputation: 1411

I have worked on android, that uses gradle for building. So assuming, that the same works for you, here are a few things that you should make sure of -

  1. Have the latest version of Gradle. v2.4 for eg has a huge performance boost over previous versions. see this http://gradle.org/docs/current/userguide/gradle_wrapper.html to help yourself with that.

  2. The next step is to enable the Gradle daemon. Using Daemon makes your builds startup faster.

  3. Moving on, enable parallel build for your project. Parallel builds will cause your projects with multiple modules to be built in parallel. You should usually be able to do this by adding a file named *gradle.properties* in your .gradle in your home directory (i.e., ~/.gradle/gradle.properties). Add org.gradle.daemon=true org.gradle.parallel=true to the file. If this doesnt work, find a way to enable the same on your computer. It helps.

These work pretty well with regard to gradle speed when used while developing android apps using android studio. I would help you out with how to enable daemon as well but I am not aware of that.

Hope this helps.

Upvotes: 2

Related Questions