'Android Studio : Could not set process working directory to "new directory"

I am doing a project using Android Studio. After change the directory to another place. I got an Error "Could not set process working directory to [my old directory path] : could not setcwd() (errno 2: No such file or directory)"



Solution 1:[1]

Follow below steps.

  1. Close android studio.
  2. Delete the .idea folder on your project folder.
  3. Start android studio and open your project. worked for me.

Solution 2:[2]

I solved it with Invalidate Caches / Restart

Solution 3:[3]

Restart Android studio and open your project from the new directory

Solution 4:[4]

It can be due to a number of reasons. The solutions below are proven to solve it

  1. Close android studio. Delete the .idea folder on your project folder.

  2. On the menu File select Invalidate Caches and restart

  3. Check if your project root folder has any invalid chars such as whitespace. If so, close Android Studio and rename the root folder.

Solution 5:[5]

This method working for me always

  1. Invalid cache
  2. Rebuild project
  3. Delete the .idea folder on your project folder.
  4. Sync project with gradle file.

But those all solution workes once after new restart of pc need to do again

Solution 6:[6]

I'll post the most embarrassing answer here.

I was running the Gradle commands from the wrong directory :).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharmishtha
Solution 2 elliptic1
Solution 3 PRAISE ELISHA
Solution 4 Miguel Tomás
Solution 5 Peter Csala
Solution 6 Adrian Elder