296

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?

9 Answers 9

395

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

Sign up to request clarification or add additional context in comments.

4 Comments

@vewert You can still run the tasks from command line, for example: ./gradlew app:dependencies
Should this option stay unticked? Or do I do it once and get it back to what it was?
I was missing the JAVA_HOME environment variable on my (fresh) system, so I just had to install Java, and all worked as expected after performing the above.
I am on Android Studio Flamingo 2022.2.1 Patch 2, and that option is no longer displayed. Instead there is an option "Only include test tasks in the Gradle task list generated during Gradle sync", and my task list only includes test tasks
283

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

Comments

43

For Android Studio Electric Eel | 2022.1.1 and later

Update Jun 23rd 2023: the same with Android Studio Flamingo

Go to Settings and uncheck this thing in below picture:

After that, sync your project again enter image description here


UPDATE for Android Studio Giraffe | 2022.3.1 Patch 1

Now, you have to CHECK the following option: (So annoying to the way they changed the UI) enter image description here

6 Comments

Lost a lot of time until I found this tick. I don't understand how she got involved.
@Maxim can I ask you: who is "she"? "Electric Eel" :)
I don't understand who ticked the box. I didn't do it. I don't know English well, google translate failed) My IDE "Flamingo RC 2"
Maybe upgrading your Android Studio made it happen
@KostadinGeorgiev check my post, I've just updated it
|
15

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.

Comments

9

Inside your android studio, select File option in toolbar -> then click on Settings option.

  1. From settings, select the last option "Experimental"
  2. Within there, select Uncheck the option that I have shared the screenshot below.
  3. Then click Apply.enter image description here

4. After that, Sync your project again from the file option, over their Sync project with Gradle Files

All set :)

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
6

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>

Comments

2

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

./gradlew tasks --all

Comments

2

I am using android Studio Koala Feature Drop | 2024.1.2 If need to generate gradle .arr file or task build do follow steps, its works for me. Setting-> Experimental-> check configure all gradle task during sync. then File-> Sync project with gradle files. enter image description here

Comments

1

I am using Android Studio Iguana | 2023.2.1 Build #AI-232.10227.8.2321.11479570, built on February 22, 2024 Runtime version: 17.0.9+0-17.0.9b1087.7-11185874 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.4.1 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 12 Metal Rendering is ON

By default, it only list the tasks about test.

Only test tasks are configured during Gradle Sync. Configuring all tasks can impact Gradle Sync performance on large projects. Show experimental settings...

Only test tasks are configured during Gradle Sync.

Then I go to Settings -> Experimental, checked "Configure all Gradle tasks during Gradle Sync (this can make Gradle Sync slower)".

Configure all Gradle tasks during Gradle Sync

Solution 2: Use terminal instead.

./gradlew tasks --all

net-security:uploadArchives - Uploads all artifacts belonging to configuration ':net-security:archives'

find the task you want, for me, it is

./gradlew net-security:uploadArchives

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.