我正在遵循关于https://guides.gradle.org/building-android-apps/的梯度教程。因此,这个部分的最后一步是运行一个构建扫描。我所做的和它要求我做的完全一样,但是Android一直在说“错误:(14,0)无法获得org.gradle.api.Project类型的根项目‘org.gradle.api.Project’的未知属性'com‘”。
下面是我的顶级构建文件(build.gradle(Project: HelloWorldGradle)):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'https://plugins.gradle.org/m2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.4.0-alpha7'
classpath 'com.gradle:build-scan-plugin:1.7.1'
}
}
apply plugin: com.gradle.build-scan
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}发布于 2017-07-08 03:04:28
问题在于您的build.gradle中的下面一行
应用插件: com.gradle.build-scan
您需要更新为
apply plugin: 'com.gradle.build-scan'您需要注意的另一件事是始终将com.gradle.build-scan插件作为第一个插件,如下所示:
apply plugin: 'com.gradle.build-scan'
apply plugin: 'java'否则,您将看到以下情况:
警告:构建扫描插件是在其他插件之后应用的。当首先应用构建扫描插件时,捕获的数据更全面。 有关如何解决此问题,请参见https://gradle.com/scans/help/plugin-late-apply。
如果这有用的话请告诉我。
发布于 2018-12-05 07:27:46
在用项目的顶级文件build.gradle编写了以下内容后,我的问题得到了解决
plugins {
id 'com.gradle.build-scan' version '1.16'
}
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
publishAlways()
}发布于 2019-07-09 03:01:50
根据gradle医生,这应该是最新的实现
plugins {
id 'com.gradle.build-scan' version '2.3'
}
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
publishAlways()
}https://stackoverflow.com/questions/44788508
复制相似问题