13

I am building basic app in Kotlin. I have added a listview and it was working fine. but when I try to implement google map then I got following error in 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'.

I have tried every available solution on the net like:

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

I have also added the plugin: apply plugin: com.gradle.build-scan but no luck.

Rajinder
  • 1,131
  • 1
  • 14
  • 29
  • There are two separate "build.gradle" files. This one is referring to the project level build.gradle, rather than your module app/build.gradle. make sure you've added it to the correct one. – Can_of_awe May 16 '18 at 16:38
  • yes, i have tried in both files but same error – Rajinder May 16 '18 at 16:45
  • Does this answer your question? [How to accept Gradle ToS for \`build --scan\` automatically and still manage to run build without a scan?](https://stackoverflow.com/questions/52636622/how-to-accept-gradle-tos-for-build-scan-automatically-and-still-manage-to-ru) – muthuraj Jul 27 '20 at 08:03

3 Answers3

4

Just remove the following code from build.gradle file and Sync your Gradle again. Everything will be resolved.

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

buildScan {
    licenseAgreementUrl = 'https://gradle.com/terms-of-service'
    licenseAgree = 'yes'
}
Avnish Choudhary
  • 828
  • 7
  • 15
4

The accepted answer in this other question works. You have to test the existence of buildScan task.

if (hasProperty('buildScan')) {
    buildScan {
        termsOfServiceUrl = 'https://gradle.com/terms-of-service'
        termsOfServiceAgree = 'yes'
    }
}
muthuraj
  • 1,033
  • 15
  • 22
1

build scan plugin was deprecated, use gradle enterprise instead.

In your settings.gradle.kts file:

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

gradleEnterprise {
  buildScan {
    termsOfServiceUrl = "https://gradle.com/terms-of-service"
    termsOfServiceAgree = "yes"
  }
}
Mihail Ya
  • 361
  • 3
  • 6