0

(gradle newbie question)

I am looking to run a custom task with code from this thread. This is to do with setting up build env for release/debug etc...

Since the code bloats the original boilerplate code, I would like to do following for readability and extensibility -

  1. Move the code to separate file as a task/def(Gist of the Code
  2. Run the task/def before assembleDebug/Release

Here are problems I face when task is appended at the end of build.gradle file:

a) If I run just the task ./gradlew buildCustom , I get error

Could not find method defaultConfig() for arguments

b) If I try to use doLast I get error

Could not find method doLast() for arguments [task ':app:assembleDebug'] on task ':app:buildCustom'.

There is something very obvious that I donot understand, appreciate any help.

Community
  • 1
  • 1
katch
  • 820
  • 1
  • 7
  • 24

0 Answers0