0

I want to create a buildTask that I can use as "gradlew someTask" from the terminal. I basically want to do a few things before I run the build ( like changing versionCode and versionName ). I've tried a few solutions:

someTask.initWith(buildTypes.debug)
someTask{
 ...
}

Doing that, I get no errors while performing a gradle sync but when I run gradlew someTask, it give me an error "someTask not found in project root" and when I run gradlew tasks, someTask does not show up in the list either. How can I fix this?

Any Help is Appreciated.
Thank You

hello_world
  • 778
  • 1
  • 10
  • 26

2 Answers2

0

Use this syntax to define your task

task myCustomTask << {
    // Put task code here
}

Usage : gradlew myCustomTask

Patrice GILBERT
  • 274
  • 3
  • 5