Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change gradle build directory in android studio?

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 would like to have them placed elsewhere (preferably outside of the project directory). Is it possible to achieve this? Where do I make a change and what change do I make?

like image 364
Pablo Jomer Avatar asked Apr 11 '14 09:04

Pablo Jomer


2 Answers

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

like image 116
Paul Verest Avatar answered Oct 27 '22 13:10

Paul Verest


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"
like image 20
MBulava Avatar answered Oct 27 '22 14:10

MBulava