All tasks are located in the build.gradle script independently or in the plugin that is used at the beginning of the script.
installDebug is set as far as I remember the Android plugin. Each task consists of actions that are performed sequentially. Here is a place to start.
You can extend the action of adding a task to the beginning of the list of internal actions.
So:
//this piece of code will run *adb connect* in the background installDebug.doFirst { def processBuilder = new ProcessBuilder(['adb', 'connnect', '192.168.1.2:5555']) processBuilder.start() } installDebug.doLast { //Do something, like - adb then open apk on my adb server.. }
Here, two actions are added to the installDebug task. If you run gradle installDebug , the first action will be performed, then the task itself, and finally the second action that will be defined. This is all in general.
source share