Invoking Gradle task on one project in Android Studio executes on all projects

I have a master gradle script with over 30 sub projects. This all works fine at the command line. I’ve imported the project into Android Studio and it all looks good when I want to build or test everything. However if I want to for instance run the tests on a single sub project, the task is run on all projects. Which not only takes a long time, but really gets in the way of testing/debugging the project that I’m interested in.

Is there a way to invoke a Gradle task on a single sub-project from within Android Studio?

Thanks, Derek

The tasks in the ‘Gradle’ window are broken down by sub-project. The only thing is the tasks for the root project are listed at the top. Running a task from the root will cascade to all child projects. You might just need to scroll down a bit (Android projects have a ton of tasks) to see the list of sub-projects.

http://imgur.com/gMx9wbf

I’m definitely invoking the tasks from the sub-project not the root. But it continues to execute that task on all sub-projects.

It makes me wonder if there is something wrong with the way I configured my whole project. Although everything works fine from the command line and also from Jenkins.

Only Android Studio is behaving strangely.

If it’s working correctly from the Gradle CLI it might very well be a bug in Android Studio.

I’m experiencing the same issue here. Android Studio 3.0.1.
I can execute subprojects tasks from CLI, but from AS the root project task is executed, so cascading ends up executing all subprojects tasks.
Any solution found so far? @dealy663, could you handle this?
I found that some of my libraries that include maven plugin do show SubProject:taskName, so the task is executed only for that subproject when I click on it…