Unable to find method ''void com.android.build.api.extension.AndroidComponentsExtension$DefaultImpls.androidTest$default(com.android.build

In my case the problem was incompatibility between Android Gradle Plugin and Hilt library. After upgrading Hilt to the latest version, I can also use the latest AGP.

[EDIT] It seems that recent release of Android Gradle Plugin has fixed the issue and AGP version 7.0.0-beta05 works with Hilt version 2.37.

Link to related Github issue


In my case AGP 7.0.0 builded successfully with Hilt 2.37