Could not create parent directory for lock file …..

Today, I wanted to do some improvement works to my apps. UNfortunately, when I open Android studio, after a few minutes startup works, android studio could not continue to build my app, and provided the following

" Could not create parent directory for lock file ….. "

it is related to gradle? I viewed the questions on stackoverflow, https://stackoverflow.com/questions/45527316/could-not-create-parent-directory-for-lock-file could not find the answer that would fix my issue,

then by accident, I remember that I had change Gradle’s default position to some other directory where I manually installed gradle myself.

project properties

Click Gradle Settings to go to gradle configuration page

restore gradle default directory
Change gradle user home to empty.

so I changed gradle configuration to its default position, which is empty , and that fortunately fixed the problem.

I don’t know and want to know the exact underlying causes, just to take a note about the fix.