Directory does not contain gradle build error even though gradle build is in directory

196 Views Asked by At

I have a project and when I try to run the main or the test directories I have no problems with the gradle build.

But now when I try to run an android test I get this error: Directory 'C:\Users...' does not contain a Gradle build.

I wrote a Compose Test that looks like this:

`@RunWith(AndroidJUnit4::class) class NavigationTest {

@get :Rule
val composeTestRule = createAndroidComposeRule<ComponentActivity>()


fun startApp_showRegistrationScreen() {
    composeTestRule.setContent {
        MyTheme {
            MyApp()
        }
    }
    val registerString = composeTestRule.activity.getString(R.string.register_for_first_time)
    composeTestRule.onNodeWithText(registerString).assertIsDisplayed()
}

}`

the error: Directory 'C:\Users\alici\MyProject\Myproject' does not contain a Gradle build.

  • Try:

Run gradle init to create a new Gradle build in this directory. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I am confused. What do I need to do?

Here the project structure:

Project strucure

0

There are 0 best solutions below