From the Gradle Tool Window in Android Studio (View > Tool Window > Gradle),
1. Right click on the the project's Gradle config with (root) next to its name.
2. Click on Ignore Gradle project,
3. and right click again then click on Unignore Gradle project.