-
打印项目所有远程依赖及子依赖
task allDeps(type: DependencyReportTask) {}
然后在右侧的gradle栏点击allDeps 或者在terminal中输入 ./gradlew allDeps 效果如下
这里写图片描述
update: 现在也可以用 AS 的 Analyze —> Analyze Dependencies 来在面板上显示依赖了,运行后在下拉选项中选择package。但是很多时候此方法不好用,还是上面介绍的方法靠谱。
-
搜索依赖库的最新版本
方法一
在AS中选中Module,点击Open Module Setting > Project Structure > Dependencies Tab > Add library dependency
在出现的界面上输入依赖名,下方就会出现搜索结果。 -
添加aar包
repositories {
flatDir {
dirs 'libs'
}
} -
修改生成APK名
在gradle文件定义函数
def releaseTime() { return new Date().format("yyyyMMdd_hh", TimeZone.getTimeZone("GMT")) }
在android块中加入:
// If you use each() to iterate through the variant objects, // you need to start using all(). That's because each() iterates // through only the objects that already exist during configuration time— // but those object don't exist at configuration time with the new model. // However, all() adapts to the new model by picking up object as they are // added during execution. android.applicationVariants.all { variant -> variant.outputs.all { outputFileName = "${variant.name}-${variant.versionName}-${releaseTime()}.apk" } }
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
options.memberLevel = JavadocMemberLevel.PUBLIC
options.charSet = 'UTF-8'
options.encoding = 'UTF-8'
destinationDir = file("../xxx/javadoc/")
include("**/IDTAPI.java")
include("**/model/**.java")
include("**/network/Callback.java")
include("**/DTSDK.java")
exclude("**/SortType.java")
exclude("**/ChannelType.java")
failOnError false
}
网友评论