I just installed Android Studio and I am just learning to build using Gradle. However, with the default project setup, my builds are located in the project directory and I w
The project iml file has a BUILD_FOLDER_PATH attribute. I haven't tried changing it myself yet, so not sure if it will work. The default value is $MODULE_DIR$/build.
Edit: I did a quick test and this did not work. Once changed, the project needs to reload because the iml file changed. Upon reload it reverts the build directory to default.
You can pass the "buildDir" property to the gradlew.bat (I'd assume you can do this in the Linux version as well but I haven't tested it)
Example:
gradlew.bat assembleRelease -PbuildDir="C:\BuildFolder"
in root build.gradle
allprojects {
buildDir = "/path/to/build/${rootProject.name}/${project.name}"
}
See also Gradle global build directory
and docs https://gradle.org/docs/current/userguide/writing_build_scripts.html