在配置项目时,我经常使用它们,但是大多数情况下都按照说明添加了窥探者。我完全不知道哪个文件到底是什么。任何人都可以清楚地看到每个文件的用途。
到目前为止,我认为local.properties
用于环境路径,例如 sdk/ndk
位置settings.gradle
,用于在项目中包括所有模块,其中每个模块都有自己的build.gradle
gradle.properties
?gradle-wrapper.properties
?
最佳答案
gradle.properties
使用gradle.properties
创建通用变量
据我所知,此解决方案仅限于Android项目。在/gradle.properties中,您可以这样定义通用或项目级别的变量:Link
gradle-wrapper.properties
在内部,Android Studio使用包装器配置中定义的Gradle版本。可以在gradle/wrapper/gradle-wrapper.properties.
中找到该配置。当Google决定是时候使用新版本的Gradle时,Android Studio会显示一条消息提示您升级。然后,您所需要做的就是单击消息,Android Studio将编辑属性文件并为您同步Gradle安装。 Link
local.propertieslocal.properties
文件位于项目的根级别。
此文件不应包含在源代码管理中。 (不正确地)将此包含在源代码管理中之后,然后在本地删除文件,Android Studio会自动为我重新创建文件。
这是此文件的示例内容:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu Aug 14 14:49:26 PDT 2014
sdk.dir=C\:\\Program Files (x86)\\Android\\android-studio\\sdk
请注意对Android Studio SDK安装位置的sdk.dir=
引用(在不同计算机上可能不同)。Link
settings.gradle
':lib'
是一个逻辑项目路径,它根据settings.gradle
中提供的信息映射到物理路径。 settings.gradle
中配置。除非您愿意,否则无需移动目录。 Link 有关gradle的更多信息,您需要检查以下链接,这些链接可以帮助您更多地了解gradle和gradle系统。 Gradle使开发人员的工作变得轻松而轻松,因为您不必对
library updation
,apk generation
,import lib easily
,product flavors
等等感到头痛。http://www.vogella.com/tutorials/Gradle/article.html
https://developer.android.com/studio/build/gradle-tips.html