title: Error: Could not resolve all artifacts for configuration ':classpath'. Cannot resolve external dependency X because no repositories are defined
body: <p>I want to add dagger hilt dependency in my project but compiler shows this message.</p>
  <p>This is error message</p>
  <pre><code>Could not resolve all artifacts for configuration ':classpath'.
     &gt; Cannot resolve external dependency com.google.dagger:hilt-android-gradle-plugin:2.38.1 because no repositories are defined.
       Required by:
           project :
  
  Possible solution:
   - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
  </code></pre>
  <p>build.gradle (projectname)</p>
  <pre><code>buildscript {
  dependencies {
      classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
  }
  }
  
  task clean(type: Delete) {
  delete rootProject.buildDir
  }
  </code></pre>
  <p>build.gradle:app</p>
  <pre><code>plugins {
  id 'com.android.application'
  id 'org.jetbrains.kotlin.android'
  id 'kotlin-kapt'
  id 'dagger.hilt.android.plugin'
  
  }
  
  android {
  compileSdk 31
  
  defaultConfig {
      applicationId &quot;com.example.paginationjetpackcompose&quot;
      minSdk 21
      targetSdk 31
      versionCode 1
      versionName &quot;1.0&quot;
  
      testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
  }
  
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard- 
  rules.pro'
      }
  }
  compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
  }
  kotlinOptions {
      jvmTarget = '1.8'
  }
  }
  
  dependencies {
  implementation 'androidx.core:core-ktx:1.8.0'
  implementation 'androidx.appcompat:appcompat:1.4.2'
  implementation 'com.google.android.material:material:1.4.0'
  implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  testImplementation 'junit:junit:4.13.2'
  androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  
  implementation 'com.google.dagger:hilt-android:2.28.3-alpha'
  kapt 'com.google.dagger:hilt-android-compiler:2.28.3-alpha'
  
  implementation &quot;androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha02&quot;
  kapt &quot;androidx.hilt:hilt-compiler:1.0.0-alpha02&quot;
  
  
  def paging_version = &quot;3.0.0-alpha02&quot;
  
  implementation &quot;androidx.paging:paging-runtime-ktx:$paging_version&quot;
  
  implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
  implementation 'com.squareup.retrofit2:retrofit:2.9.0' 
  }
  </code></pre>