Url依赖
Jar依赖
AAR依赖(library直接使用aar依赖会有问题,后面说)
repositories{
flatDir{
dirs 'libs'
}
}
dependencies {
implementation(name: 'appcompat-v7-25.3.1', ext: 'aar')
}
Project依赖
批量依赖(依赖libs文件夹下面的所有jar)
批量依赖(依赖libs文件夹下面的所有aar)
Url依赖移除指定依赖
transitive依赖
transitive dependencies 被称为依赖的依赖,称为“间接依赖”比较合适。
在后面加上@aar,意指你只是下载该aar包,而并不下载该aar包所依赖的其他库,那如果想在使用@aar的前提下还能下载其依赖库,则需要添加transitive=true的条件。
implementation api compileOnly 的区别
implementation :
依赖但不穿透(比如:A implementation B,B implementation C,此时A调用不了C的类和方法)
api
依赖并且穿透(比如:A api B,B api C,此时A可以调用C的类和方法)
compileOnly
仅参与编译(打包时,不打入APK文件中,)