title: Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
body: <p>I want to add jitpack.io as a repository in my gradle file.
  This is my gradle root file:</p>
  <pre><code>buildscript {
      repositories {
          google()
          mavenCentral()
      }
      dependencies {
          classpath &quot;com.android.tools.build:gradle:7.0.2&quot;
          classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21&quot;
  
          classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  <p>Since I DON'T have a &quot;allrepositories&quot; to put my dependency there (only works there), I've created and added this code after buildscript code:</p>
  <pre><code>allprojects {
      repositories {
          maven {url 'https://www.jitpack.io'}
      }
  }
  </code></pre>
  <p>But this is the error I get</p>
  <pre><code>Caused by: org.gradle.api.InvalidUserCodeException: Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
  </code></pre>