5

I have a project made with Android Studio 3.0 with coworkers. There are so many Tasks for installing the application. After I finished updating the Android Studio from 3.0 to 3.3.2, almost tasks in project(root)>tasks are not visible. Checkout my gradle project below.

3.0 :

my-project
ㄴmy-project (root)
  ㄴTasks
    ㄴandroid
    ㄴbuild
    ㄴbuild setup
    ㄴhelp
    ㄴinstall
    ㄴother
    ㄴverification
ㄴmy-module-one
  ㄴTasks
    ㄴandroid
    ㄴbuild
    ㄴhelp
    ㄴinstall
    ㄴother
    ㄴverification
ㄴmy-module-two
...

3.3.2 :

my-project
ㄴmy-project (root)
  ㄴTasks
    ㄴbuild setup
    ㄴhelp
    ㄴother
ㄴmy-module-one
  ㄴTasks
    ㄴandroid
    ㄴbuild
    ㄴcleanup
    ㄴhelp
    ㄴinstall
    ㄴother
    ㄴverification
ㄴmy-module-two
...

I can check some tasks are not visible and suddenly the "cleanup" thing appears in every modules. How can i solve it and What's the reason of these problems.

auspicious99
  • 3,902
  • 1
  • 44
  • 58
김진우
  • 161
  • 3
  • 12

3 Answers3

12

Had the same problem: after import from GitHub there weren't any Gradle tasks in Android Studio. Spent hours on solving this issue but nothing helped. Only these steps solved problem in my case:

  1. In Android Studio go to File -> Settings... -> Experimental and uncheck the Do not build Gradle task list during Gradle build checkbox.
  2. Delete cloned project and clone it again (if some of required files like keystore properties are not present, add them and do File -> Invalidate Caches / Restart).
the korovay
  • 563
  • 4
  • 16
  • worked for me. but i didnt even need to do step number 2. i just sycned gradle again and it worked – or_dvir Jul 02 '21 at 13:18
6

Android Studio 4.2 has a new experimental feature for Gradle, which is Do not build Gradle task list during Gradle sync. Unfortunately, it comes checked (on) by default, and results in the Gradle task list not being visible in the Gradle view. This because the Gradle task list is not even being generated. However, it leaves many of us wondering what happened to the Gradle task list.

You can go to Settings (e.g., File -> Settings on windows, Preferences -> Settings on mac) and go to Experimental. There you can uncheck the new option. Experimental Settings in Android Studio 4.2

Then just click on Sync Project with Gradle Files and the Gradle task list will be generated and visible again.

auspicious99
  • 3,902
  • 1
  • 44
  • 58
2

Accroding to this link

Behavior changes:

  • Lazy task configuration: The plugin now uses Gradle’s new task creation API to avoid initializing and configuring tasks that are not required to complete the current build (or tasks not on the execution task graph). For example, if you have multiple build variants, such as “release” and “debug” build variants, and you're building the “debug” version of your app, the plugin avoids initializing and configuring tasks for the “release” version of your app. Calling certain older methods in the Variants API, such as variant.getJavaCompile(), might still force task configuration. To make sure that your build is optimized for lazy task configuration, invoke new methods that instead return a TaskProvider object, such as variant.getJavaCompileProvider(). If you execute custom build tasks, learn how to adapt to Gradle’s new task-creation API.