Android項(xiàng)目中開啟Gradle的build scan(構(gòu)建審視)

  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. 在控制臺執(zhí)行命令 ./gradlew build --scan
  2. 命令執(zhí)行完后會給出一個網(wǎng)址,打開網(wǎng)址根據(jù)提示就可以得到相應(yīng)的構(gòu)建審核內(nèi)容,如下圖:


    image.png

注意

  1. Gradle不同的版本對應(yīng)的build-scan-plugin的版本也不同,可以在官網(wǎng)查看對應(yīng)的版本號(上面示例使用Gradle的4.2.1版本);
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容