Android gradle project directory variable

android, gradle

Solution

See the Gradle docs. Specifically, you're interested in `projectDir` (The directory containing the build script) or `buildDir` (projectDir/build).

Problem

I am trying to write a script in gradle that requires opening up a file. I am trying to find the current directory where the project is installed. so I can open a file in my "raw" directory. Note: I am aware that I can use a temporary file to find the current location of the application. However, I am trying to stay away from that solution. I am trying to find out if gradle has a buildDir variable that I can use in my task instead.

Original source