This issue may be due to a misconfigured project path or an incorrectly set project directory in Android Studio.
Invalidate Cache and Restart:
Go to File > Invalidate Caches / Restart and select Invalidate and Restart. This forces Android Studio to clear its cache and might fix the directory issue.
Check Project Paths in Settings:
Open File > Settings > Build, Execution, Deployment > Build Tools > Gradle. Ensure that the Gradle user home path is set correctly. Delete .idea and .gradle Folders:
Close Android Studio.
In your project’s root directory, delete the .idea folder and the .gradle folder if they’re pointing to incorrect paths. Reopen Android Studio, and it should recreate these folders in the correct directory.
Re-import Project:
Close the project and go to File > Open to re-import it from the correct directory. This ensures Android Studio resets its internal paths.
If the issue persists, you may also want to check for any custom configurations or symlinks in your project setup that could be redirecting Android Studio to the wrong folder.