I updated my Android Studio Canary to version 2020 3.1 Canary 15 which also required me to update my AGP to version 7.0.0-alpha15. I am using kotlin-gradle-dsl as my gradle build files which are now failing to build with an Unresolved reference.
Note that the gradle was successfully building before updating to version 7.0.0-alpha15.
My app level build.gradle.kts is as follows:
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
plugins {
    id("com.android.application")
    id("kotlin-android")
    id("kotlin-kapt")
    id("dagger.hilt.android.plugin")
}
val apiKey: String = gradleLocalProperties(rootDir).getProperty("API_KEY")
android {
    compileSdkVersion(30)
    buildToolsVersion("30.0.3")
    defaultConfig {
        applicationId("com.training.flicker")
        minSdkVersion(21)
        targetSdkVersion(30)
        versionCode(1)
        versionName = "1.0"
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
        buildConfigField("String", "API_KEY", apiKey)
    }
    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"
        useIR = true
    }
    buildFeatures.compose = true
    composeOptions.kotlinCompilerExtensionVersion = Version.compose
}
dependencies {
    implementation(Android.coreKtx)
    implementation(Android.appCompat)
    implementation(Android.material)
    implementation(Retrofit.retrofit)
    implementation(Retrofit.convertorGson)
    implementation(Hilt.hiltAndroid)
    kapt(Hilt.hiltKapt)
    implementation(Compose.material)
    implementation(Compose.tooling)
    implementation(Compose.ui)
    implementation(Compose.activity)
    implementation(Coroutines.android)
    implementation(Arch.runtime)
    implementation(Arch.viewModel)
    implementation(Arch.liveData)
    testImplementation(Test.junit)
    androidTestImplementation(Test.androidJunit)
    androidTestImplementation(Test.espressoCore)
    androidTestImplementation(Test.composeUi)
}
This is the error that I am getting
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public inline operator fun <T : Any, C : NamedDomainObjectContainer<TypeVariable(T)>> TypeVariable(C).invoke(configuration: Action<NamedDomainObjectContainerScope<TypeVariable(T)>>): TypeVariable(C) defined in org.gradle.kotlin.dsl
public operator fun <T> Closure<TypeVariable(T)>.invoke(): TypeVariable(T) defined in org.gradle.kotlin.dsl
public operator fun <T> Closure<TypeVariable(T)>.invoke(x: Any?): TypeVariable(T) defined in org.gradle.kotlin.dsl
public operator fun <T> Closure<TypeVariable(T)>.invoke(vararg xs: Any?): TypeVariable(T) defined in org.gradle.kotlin.dsl
public operator fun <V> Callable<TypeVariable(V)>.invoke(): TypeVariable(V) defined in org.gradle.kotlin.dsl
public operator fun <T, R> DeepRecursiveFunction<TypeVariable(T), TypeVariable(R)>.invoke(value: TypeVariable(T)): TypeVariable(R) defined in kotlin
...
                Actually there was an issue with the AGP, because of which gradle was crashing.
The issue was fixed in the next release of AGP. Currently I am using AGP 7.0.0 with dagger hilt version 2.37 in android studio Arctic Fox with no issues.
// project level build.gradle
dependencies {
    classpath "com.android.tools.build:gradle:7.0.0"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"
    classpath "com.google.dagger:hilt-android-gradle-plugin:2.37"
}
...
// app level build.gradle
implementation "com.google.dagger:hilt-android:2.37"
kapt "com.google.dagger:hilt-android-compiler:2.37"
...
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With