配置gradle有时会用一些路径相关的环境变量,常用的几个定义如下。
projectDir
The directory containing the project build file.
rootDir
The root directory of this project. The root directory is the project directory of the root project.
buildDir
The build directory of this project. The build directory is the directory which all artifacts are generated into. The default value for the build directory is projectDir/build
【举例说明】
新建一个工程名为InspectGradleDir,路径为
D:\study\android\projects\InspectGradleDir
那么rootDir对应
D:\study\android\projects\InspectGradleDir
projectDir对应
D:\study\android\projects\InspectGradleDir\app
buildDir对应
D:\study\android\projects\InspectGradleDir\app\build