Android项目中开启Gradle的build scan(构建审视)

  1. 在Project的build.gradle文件添加下面几行代码:
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        #下面这句是添加的
        classpath 'com.gradle:build-scan-plugin:1.8'  

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

#下面5行是添加的
apply plugin: 'com.gradle.build-scan'    
buildScan {                     
    licenseAgreementUrl = 'https://gradle.com/terms-of-service'
    licenseAgree = 'yes'
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
  1. 在控制台执行命令 ./gradlew build –scan
  2. 命令执行完后会给出一个网址,打开网址根据提示就可以得到相应的构建审核内容,如下图:

    《Android项目中开启Gradle的build scan(构建审视)》 image.png

注意

  1. Gradle不同的版本对应的build-scan-plugin的版本也不同,可以在官网查看对应的版本号(上面示例使用Gradle的4.2.1版本);
    原文作者:GCZeng
    原文地址: https://www.jianshu.com/p/d08d885c4301
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞