Android Studio Mark Directory as Test Sources Root

2020-07-02 09:49发布

问题:

I've done something in build.gradle to remove the green highlighting of the androidTest.java package.

I don't know how to get it back.

IntelliJ has a "Mark directory as test sources root" option in the context menu but I can't find the equivalent in Android Studio.

Is there a way to define this folder so I can start testing? (If it means anything, the test java files all have an icon of a "J" with a red circle around it)

回答1:

You can click on the folder and type Cmd + Shift + a to enter the action search and then by typing Mark directory as you will get the menu.



回答2:

For me, this option is no longer so easily available. To access it I need to double tap 'shift' and manually type "mark directory as. Then I can pick it from the list."