No Gradle Tool Window in IntelliJ IDEA 13?

Intellij IdeaGradle

Intellij Idea Problem Overview


I can't find the Gradle Tool Window in IntelliJ IDEA 13 anymore. Is it removed?

Furthermore I can't run any Gradle Tasks within my Gradle build file (via context-menu -> Run). The error message: Module XY is not backed by gradle occurs. All these runs perfectly in IntelliJ IDEA 12.

What is going wrong here?

Intellij Idea Solutions


Solution 1 - Intellij Idea

TL;DR

As of 2018.3.6:

  1. In the project tool window locate the build.gradle/build.gradle.kts file
  2. Right click the build file and select Link Gradle Project (or Import Gradle Project in some IntelliJ IDEA versions)

Background

In regards to the OP's question at the time when IDEA 13 was released, the Gradle Plugin was rewritten and improved in IntelliJ IDEA 13. As a result, Gradle based IDEA projects created in previous versions of IntelliJ IDEA needed to be reimported when first opened in IntelliJ IDEA 13.

Post IntelliJ IDEA 13, sometimes the Gradle Tool window will disappear if the IntelliJ IDEA Project gets out of sync or its configuration gets corrupted.

The Fix

IntelliJ IDEA 2018.3.6 or Later

The quick fix
  1. Find and select the build.gradle/build.gradle.kts file in the Project tool window
  2. Open the context menu (i.e. right click) and select Link Gradle Project or Import Gradle Project in some versions. (I'm not sure in which version the menu item name got changed.)

NOTE 1: If the context menu option is not available, then that typically means the Gradle Plugin got disabled or uninstalled. Go to Settings/Preferences > Plugins and enable or install the JetBrains Gradle plugin.

NOTE 2: If the gradle build can not be completed successfully, IntelliJ IDEA may not be able to sync to it properly. In such cases, you will likely need to get the gradle build working first.

When the Quick Fix does not work

While the above "Quick Fix" should work most of the time, if it does not work, you may need to:

  1. If not already done, try the above "Quick Fix". Proceed if that does not resolve the issue.
  2. Invalidate your caches via File > Invalidate Caches.
  3. Restart IntelliJ IDEA.
  4. Wait for the project to get re-indexed. (Watch the progress on right side of the bottom Status Bar of the IntelliJ IDEA window.)
  5. If the Gradle window does not show after indexing finishes, run the steps in the above "Quick Fix".
  6. The above steps should solve the issue in almost all cases. If not, close the project in IntelliJ IDEA. In the system, look for the gradle.xml file in the project's .idea directory. Delete or rename it. (If you have gotten to this point, it is most likely this file has been corrupted and we want IntelliJ IDEA to recreate it.) Then reopen the project in IntelliJ IDEA and run the quick fix.

IntelliJ IDEA Pre version 2018.3.6

First, see if the tool window can be opened via View > Tool Windows > Gradle. If so, the gradle project is configured and ready to use. If not, you will need to re-import the project as discussed below.

While your project settings should be maintained, it would be prudent to backup the .idea directory prior to doing the re-import. Go to File > Import Project (or File > New > Project from Existing Sources in newer IntelliJ versions), select and import your *.gradle file. You can choose "This Window" when prompted as to what window to open the project in. You will then have the Gradle window (renamed from JetGradle) and gradle functionality. All your previous project settings should remain intact. If not, close the project and do a diff of the backed-up and current .idea directories.

For some versions of IDEA, the above may not work if done with the project opened. Instead, you will need to close the project, and do the import from the Welcome Screen or another project. This also holds true if the project was never a gradle project and you want to add gradle functionality/backing.

Solution 2 - Intellij Idea

IntelliJ have certainly had trouble solving this particular problem, but as of 2018.3.6 the solution has certainly gotten better:

  1. find the gradle.build file
  2. right-click on it and select Import Gradle Project

no idea (badoom tshhhh) why they've decided to do it this way, but it works, the Gradle tool window becomes available, and it has become a gradle project.

Solution 3 - Intellij Idea

You can add a gradle.xml file in your .idea directory

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="GradleSettings">
    <option name="linkedExternalProjectsSettings">
      <GradleProjectSettings>
        <option name="distributionType" value="LOCAL" />
        <option name="externalProjectPath" value="$PROJECT_DIR$" />
        <option name="gradleHome" value="$USER_HOME$/.gradle" />
        <option name="gradleJvm" value="1.8.0_40" />
      </GradleProjectSettings>
    </option>
  </component>
</project>

This should enable the gradle panel to show up.

Make sure to replace the correct paths above

Solution 4 - Intellij Idea

What helped me was File > Invalidate Chaches and Restart
After restarting the gradle menu was available

Solution 5 - Intellij Idea

In IntelliJ IDEA 2016.2.2 version, from main menu, try;

View->Tool windows-> Gradle

Update: For those who are downvoting, this answer gave the menu solution before the accepted answer.

Solution 6 - Intellij Idea

This helped me: (In IntelliJ 2019.2.4)

  1. File -> Invalidate Caches/Eestart
  2. Right Click on your build.gradle in your Project in Project View -> At the bottom click on : Import Gradle Project
  3. View -> Tool Windows -> Gradle

Solution 7 - Intellij Idea

> What is going wrong here?

The possible reason is that GRADLE_HOME environment variable points to the wrong location.

Solution 8 - Intellij Idea

Solution 9 - Intellij Idea

It worked for me.Workaround is to close the cloned project, and then open the build.gradle/build.gradle.kts file as a project.

Solution 10 - Intellij Idea

In IntelliJ 2019.3 I faced the same issue, in addition it was not recognizing Gradle projects when I imported them. I fixed it by doing this:

  1. Disable Gradle plugin
  2. Restart IntelliJ
  3. Enable Gradle plugin again
  4. Restart IntelliJ

Done!

enter image description here

Solution 11 - Intellij Idea

I'm using Intellij 2021.2.1 Ultimate. For me the following steps worked-

  1. Open plugin section under Settings.
  2. Enable Gradle plugin.
  3. Restart Intellij by invalidating caches
  4. Let Intellij complete the indexing

That's all.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGedankenNebelView Question on Stackoverflow
Solution 1 - Intellij IdeaJavaruView Answer on Stackoverflow
Solution 2 - Intellij IdeaMichael CoxonView Answer on Stackoverflow
Solution 3 - Intellij IdeaseantomburkeView Answer on Stackoverflow
Solution 4 - Intellij IdeaSimon SchnellView Answer on Stackoverflow
Solution 5 - Intellij IdeamyuceView Answer on Stackoverflow
Solution 6 - Intellij IdeabbrinckView Answer on Stackoverflow
Solution 7 - Intellij IdeanaXa stands with UkraineView Answer on Stackoverflow
Solution 8 - Intellij IdearadistaoView Answer on Stackoverflow
Solution 9 - Intellij IdeaRAHUL KUMARView Answer on Stackoverflow
Solution 10 - Intellij IdeaswngstackView Answer on Stackoverflow
Solution 11 - Intellij IdeaCaffeine CoderView Answer on Stackoverflow