Gradle tasks are not showing in the gradle tool window in Android Studio 4.2

Android StudioGradleAndroid Studio-4.2

Android Studio Problem Overview


I just updated Android Studio to version 4.2. I was surprised to not see the Gradle tasks in my project.

In the previous version, 4.1.3, I could see the tasks as shown here:

working in version 4.1.3

But now I only see the dependencies in version 4.2:

Not working in 4.2

I tried to clear Android Studio's cache and sync my project again, but there was no change.

Is this a feature change?

Android Studio Solutions


Solution 1 - Android Studio

OK, I found why I got this behaviour in android studio 4.2.

It is intended behaviour. I found the answer in this post: https://issuetracker.google.com/issues/185420705.

> Gradle task list is large and slow to populate in Android projects. > This feature by default is disabled for performance reasons. You can > re-enable it in: Settings | Experimental | Do not build Gradle task > list during Gradle sync.

Reload the Gradle project by clicking the "Sync Project with gradle Files" icon and the tasks will appear.

It could be cool that this experimental change is put in the release note of android studio 4.2.

enter image description here

enter image description here

Solution 2 - Android Studio

Go to File -> Settings -> Experimental and uncheck Do not build Gradle task list during Gradle sync, then sync the project File -> Sync Project with Gradle Files. If the problem is still there, just reboot Android Studio.

1.Do not build Gradle task list during Gradle sync

enter image description here

Solution 3 - Android Studio

Solution 1:

You can alternatively use the below gradle command to get all the tasks and run those in terminal

./gradlew tasks --all

Solution 2.

You can also create run configuration to run the tasks like below:

Step 1:

enter image description here

Step 2:

enter image description here

Step 3:

enter image description here

Then your run configuration will be listed like in step 1 image. You can choose and simply run it as usual.

Solution 4 - Android Studio

To check the task list use the below command

./gradlew task

You will get the list of available task. To execute a particular task run command as follow

./gradlew <taskname>

Solution 5 - Android Studio

I had a similar issue and I solved it by executing the following terminal command in my Android Studio Terminal:

./gradlew tasks --all

Solution 6 - Android Studio

Uncheck the option of "Do not build Gradle task..." then "Sync Project with Gradle files" and it will show up.

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
QuestionLeMimitView Question on Stackoverflow
Solution 1 - Android StudioLeMimitView Answer on Stackoverflow
Solution 2 - Android StudioAliaksei KiselView Answer on Stackoverflow
Solution 3 - Android StudioRajesh.kView Answer on Stackoverflow
Solution 4 - Android StudioMinionView Answer on Stackoverflow
Solution 5 - Android StudiowilfredView Answer on Stackoverflow
Solution 6 - Android StudioMomina JavedView Answer on Stackoverflow