Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Task 'testClasses' not found in project

I finally have a Test Case setup for Roboelectric but when I try to run it from Android Studio, get this error: Task 'testClasses' not found in project 'myExternalProjectName'

Error:Could not execute build using Gradle installation 'C:\Users\Mike.gradle\wrapper\dists\gradle-2.2.1-all\c64ydeuardnfqctvr1gm30w53\gradle-2.2.1'.

NOTES: 1. When I run from gradle cmd line(gradlew build) the tests run fine 2. I'M USING : org.robolectric:robolectric:3.0

I have modules in my project as AARs. How can I get around this issue?

like image 628
Mike6679 Avatar asked Sep 12 '25 12:09

Mike6679


2 Answers

To bypass the error, please add below code in build.gradle

tasks.register("testClasses")

This error happens when I rebuild the project and this is from Kotlin Multiplatform plugin/library. Still don't know the actual error cause.

EDIT: The tasks.register("testClasses") line should go in the shared module's build.gradle.kts file, within the kotlin { } block.

like image 131
Ashutosh Wahane Avatar answered Sep 16 '25 06:09

Ashutosh Wahane


I just had this error after setting up signing configs. File -> invalidate caches -> invalidate and restart resolved the issue for me.

like image 35
Chris Wickens Avatar answered Sep 16 '25 07:09

Chris Wickens