赞
踩
编译后基于usage.txt 和 resources.txt 的结果,可以通过task来过滤,排序处理。可参考以下:
task codeScan(dependsOn: assembleRelease) {
…
doLast {
if (project.getBuildDir().exists()) {
String basePath = project.getBuildDir().path + “/outputs/mapping/release/”
//无用Class
File uoUseClassRecode = new File(basePath + “usage.txt”)
if (uoUseClassRecode.exists()) {
FileReader fr = new FileReader(uoUseClassRecode)
BufferedReader reader = new BufferedReader(fr)
List classList = new ArrayList<>()
ClassRecorder recorder = null
String packageName = “${project.android.defaultConfig.applicationId}”
if (packageName == null || packageName.size() == 0) {
throw new IllegalArgumentException(
“packageName为空,请检查是否在build.gradle的defaultConfig中配置applicationId属性”)
}
while(reader.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。