Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Version 6.7.1 - Upgrade Failed

I have upgraded my Android Studio to 4.2 version few hours ago, and now when I opened one of my old projects I got a message from Android studio to upgrade Gradle version to 6.7.1. After I did that I got this error message and I can't build my project anymore... I also tried provided solutions from Android Studio, but with no success. Any help?

enter image description here

enter image description here

Error:

Unable to find method ''void com.android.build.api.extension.AndroidComponentsExtension$DefaultImpls.androidTest$default(com.android.build.api.extension.AndroidComponentsExtension, com.android.build.api.extension.VariantSelector, kotlin.jvm.functions.Function1, int, java.lang.Object)'' 'void com.android.build.api.extension.AndroidComponentsExtension$DefaultImpls.androidTest$default(com.android.build.api.extension.AndroidComponentsExtension, com.android.build.api.extension.VariantSelector, kotlin.jvm.functions.Function1, int, java.lang.Object)'

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network) The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart) Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

like image 803
Hassa Avatar asked Dec 18 '22 11:12

Hassa


2 Answers

if you us dagger hilt change the version of dagger hilt

Using a combination of

Hilt version 2.35 Android Studio version 4.2 Android Gradle Plugin version 4.2.0 Gradle version to 6.7.1

worked for me

documentaire https://github.com/google/dagger/issues/2337

like image 121
Khaled Habbachi Avatar answered Dec 21 '22 09:12

Khaled Habbachi


This solution from the Dagger Github solved it for me. https://github.com/google/dagger/issues/2337

repositories {
        /*  ...  */
         maven {
            url  "https://oss.sonatype.org/content/repositories/snapshots"
            content {
                includeModule("com.google.dagger", "hilt-android-gradle-plugin")
            }
        }
}

    dependencies {
       
        classpath "com.google.dagger:hilt-android-gradle-plugin:HEAD-SNAPSHOT"
        
    }
like image 20
Oscar Lundqvist Avatar answered Dec 21 '22 11:12

Oscar Lundqvist