Android Plugin DSL Reference 参考文档 :
org.gradle.api.Project 配置 ( build.gradle 根配置 ) 文档 : https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html
在 build.gradle#dependencies 配置中 , 使用 implementation fileTree 引入文件树 , 将当前目录中 libs 目录下的所有 .jar 后缀的文件添加到依赖中 ;
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
fileTree 函数原型定义在 org.gradle.api.Project 配置中 , 在 Project 中提供了 4 种重载方法 ;
ConfigurableFileTree fileTree(Object baseDir)
Creates a new ConfigurableFileTree using the given base directory.
ConfigurableFileTree fileTree(Object baseDir, Closure configureClosure)
Creates a new ConfigurableFileTree using the given base directory.
ConfigurableFileTree fileTree(Object baseDir, Action<? super ConfigurableFileTree> configureAction)
Creates a new ConfigurableFileTree using the given base directory.
ConfigurableFileTree fileTree(Map<String,?> args)
Creates a new ConfigurableFileTree using the provided map of arguments.
文档位置 : https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#fileTree-java.lang.Object-
org.gradle.api.Project 配置 ( build.gradle 根配置 ) 文档 : https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html
在 build.gradle#dependencies 配置中 , 使用 implementation files 引入多个文件 , 将这些文件添加到依赖中 ;
dependencies {
implementation files('libs/ffmpeg.jar', 'libs/location.jar')
}
files 函数原型定义在 org.gradle.api.Project 配置中 , 在 Project 中提供了 3 种重载方法 ;
注意 file 函数只能指定一个文件 ;
File file(Object path)
Resolves a file path relative to the project directory of this project.
File file(Object path, PathValidation validation)
Resolves a file path relative to the project directory of this project and validates it using the given scheme.
ConfigurableFileCollection files(Object... paths)
Returns a ConfigurableFileCollection containing the given files.
ConfigurableFileCollection files(Object paths, Closure configureClosure)
Creates a new ConfigurableFileCollection using the given paths.
ConfigurableFileCollection files(Object paths, Action<? super ConfigurableFileCollection> configureAction)
Creates a new ConfigurableFileCollection using the given paths.
参考文档 : https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#files-java.lang.Object…-