Running task from AndroidStudio can't find "assembleRelease" works fine from gradlew


I have a multi module project, I have written a script that runs on all projects this is working fine from cmd using gradlww but when running in Android Studio it can’t find the dependson “assemble”/“assembleRelease”

I have a stackoverflow for this

Any help is appreciated

Does ‘assembleRelease’ exist as a task on the root project?

If you had this project:

// in the root build.gradle
project(":sub1") {
   task assembleRelease

allprojects {
   task assemblePush(dependsOn: [ 'assembleRelease' ])

// in settings.gradle
include 'sub1'

You would be able to run gradle sub1:assemblePush, but gradle assemblePush or gradle :assemblePush would both fail because ‘assembleRelease’ is only a task in the subproject sub1. Maybe you wanted to use subprojects {}, which doesn’t include the root project, instead of allprojects {}.

Thank you moving it to subprojects has made it work.

I am now however having a problem with the line

 def killCommand = "adb shell kill \$(adb shell procrank | grep " + getPackageName( + " | awk '{print \$1}')"

        def killApp = exec {
            commandLine "sh", "-c", killCommand

grep: APPLICATION: No such file or directory
grep: NAME: No such file or directory
grep: FOUND: No such file or directory
Error:-signame] { job | pid | pgrp } …
kill -l [exit_status …]

Again this works fine from command line.