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?
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.
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
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"
}
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