Android Studio错误:未发布生成扫描

nhjlsmyf  于 2023-01-15  发布在  Android
关注(0)|答案(4)|浏览(228)

我正在Kotlin构建基本的应用程序。我添加了一个列表视图,它工作正常。但当我试图实现谷歌Map,然后我在Android Studio 3. 1中得到以下错误。

The build scan was not published due to a configuration problem.
    
   The Gradle Cloud Services license agreement has not been agreed to.
    
   To agree to the license, include the following in your root project's configuration:
    buildScan { licenseAgreementUrl = 'https://gradle.com/terms-of-service'; licenseAgree = 'yes' }
    
   For more information, please see https://gradle.com/scans/help/plugin-license.
    
   Alternatively, if you are using Gradle Enterprise, specify the server location.
    For more information, please see https://gradle.com/scans/help/plugin-enterprise-config.
    
   9:27:52 PM: Task execution finished 'signingReport'.

我已经尝试了网上的每一个可用的解决方案,如:

buildScan {
  licenseAgreementUrl = "https://gradle.com/terms-of-service"
  licenseAgree = "yes"
}

我还添加了插件:apply plugin: com.gradle.build-scan但没有运气。

pgky5nke

pgky5nke1#

只需从build.gradle文件中删除以下代码,然后再次同步Gradle。所有问题都会得到解决。

apply plugin: 'com.gradle.build-scan'

buildScan {
    licenseAgreementUrl = 'https://gradle.com/terms-of-service'
    licenseAgree = 'yes'
}
shstlldc

shstlldc2#

The accepted answer in this other question works,需要测试buildScan任务是否存在。

if (hasProperty('buildScan')) {
    buildScan {
        termsOfServiceUrl = 'https://gradle.com/terms-of-service'
        termsOfServiceAgree = 'yes'
    }
}
cqoc49vn

cqoc49vn3#

我刚刚同步了我的gradle文件,构建成功

yqlxgs2m

yqlxgs2m4#

构建扫描插件已弃用,请改用gradle Enterprise。
settings.gradle.kts文件中:

plugins {
  id("com.gradle.enterprise") version("3.12.2")
}

gradleEnterprise {
  buildScan {
    termsOfServiceUrl = "https://gradle.com/terms-of-service"
    termsOfServiceAgree = "yes"
  }
}

相关问题