The "Record espresso test" option is greyed out in Android Studio.
What are possible reasons for this?
I have installed the Espresso test dependencies and I have an emulator running.
The "Record espresso test" option is greyed out in Android Studio.
What are possible reasons for this?
I have installed the Espresso test dependencies and I have an emulator running.
2
Answers
I’m having the same issue.
I thought it’s because we need to do the proper setup first (gradle-wise), so I did. No change.
Then I thought maybe we need to already have a build configuration for instrumented tests first. Did it, no change.
Then I thought maybe we need a first test to exist already. Did it. No change.
Note that AS shows Espresso Test Recorder as enabled in the plugin, and at launch, the option is available in the menu, it’s only after the IDE loading is finished that it becomes unavailble.
It seems like Espresso isn’t available for Compose, could it be your issue?
I guess there are plenty of reasons why that could happen. Most likely one these days is the usage of Jetpack Compose (as mentioned in other answers).
Without further info on your setup, speculating of which bit of configuration might be causing this will quickly turn to the proverbial looking for a needle in a haystack.
I tried creating two new projects from scratch in AS Iguana, one with Compose (choosing "Empty Activity") and one with Views (choosing "Empty Views Activity"): in the Compose one the "Record Espresso Test" option is disabled while in the Views one it’s enabled: this points again to Compose being one clear culprit.
If you can exclude that from being the cause (eg. you don’t use compose) I suggest to replicate the step mentioned above: create a new Views project, verify that the record functionality is there and go on comparing the new project with yours to see what’s missing.