Reputation: 145
There is gradle plugin task that can be run from commandline like this -
$ ./gradlew runThisPlugin
But I want this plugin task to execute when gradle build is running (after I hit 'Run' or 'Rebuild' in Android studio). I am actually trying to eliminate the manual work here.
Is there any way to configure the plugin or gradle to run this task automatically when I build the project instead of running it manually from command line?
Upvotes: 0
Views: 1063
Reputation: 318
From the official documentation:
The default run/debug configuration launches the default project activity and uses the Select Deployment Target dialog for target device selection. If the default settings don't suit your project or module, you can customize the run/debug configuration, or even create a new one, at the project, default, and module levels. To edit a run/debug configuration, select Run > Edit Configurations.
In the bottom right part of the screen, there is a Before launch menu.
Click on the + sign, and select Run Gradle Task
A Select Gradle Task dialog will appear.
Here select Gradle Project that you want, and Tasks that you want to run.
Click Ok two times and you are done.
Note that you task will be run before the build.
Here is a link to official documentation.
Upvotes: 1