My build file is big and hard to maintain, how to split the build file into separate files with smaller tasks to be imported into the main gradle file
To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this: On Windows: gradlew <task1> <task2> … e.g. gradlew clean allTests.
Android Studio projects contain a top-level project Gradle build file that allows you to add the configuration options common to all application modules in the project. Each application module also has its own build. gradle file for build settings specific to that module.
gradle for one project? Yes. You can have multiple build files in one project.
build.gradle
apply from: 'other.gradle'
other.gradle
println "configuring $project"
task hello << {
println 'hello from other script'
}
Output of gradle -q hello
> gradle -q hello
configuring root project 'configureProjectUsingScript'
hello from other script
Source: Configuring the project using an external build script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With