Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 292
LeMimit Avatar asked Oct 09 '22 00:10

LeMimit


People also ask

How do I enable tasks in Gradle?

Run a Gradle task via Run ConfigurationsRight-click the task for which you want to create the Run configuration. From the context menu select Modify Run Configuration. In Create Run Configuration: 'task name', you can use the default settings or configure the additional options and click OK.

How do I view tasks in Gradle?

Within IntelliJ IDEA, find the check task in the Gradle tool window under verification. Double click it to run. Check is also run when you run the build task, thanks to a task dependency setup by the base plugin. Gradle runs the assemble task then check.

Which Gradle display available tasks?

To see which tasks are available for our build we can run Gradle with the command-line option -t or --tasks. Gradle outputs the available tasks from our build script. By default only the tasks which are dependencies on other tasks are shown. To see all tasks we must add the command-line option --all.


Video Answer


2 Answers

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

like image 329
LeMimit Avatar answered Oct 11 '22 12:10

LeMimit


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

2. enter image description here

like image 268
Aliaksei Kisel Avatar answered Oct 11 '22 14:10

Aliaksei Kisel