美文网首页
Android项目中开启Gradle的build scan(构建

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

作者: GCZeng | 来源:发表于2017-11-03 22:16 被阅读785次
    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. 命令执行完后会给出一个网址,打开网址根据提示就可以得到相应的构建审核内容,如下图:


      image.png

    注意

    1. Gradle不同的版本对应的build-scan-plugin的版本也不同,可以在官网查看对应的版本号(上面示例使用Gradle的4.2.1版本);

    相关文章

      网友评论

          本文标题:Android项目中开启Gradle的build scan(构建

          本文链接:https://www.haomeiwen.com/subject/gzexmxtx.html