我正在关注https://guides.gradle.org/building-android-apps/上的Gradle教程。因此,本部分的最后一个是“运行构建扫描”。我做的和要求我做的完全一样。但是Android Studio一直说“错误:(14,0)无法获得类型为org.gradle.api.Project的根项目'HelloWorldGradle'的未知属性'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
}
Run Code Online (Sandbox Code Playgroud)