I had the same error message. Tried to delete the caches file. This did -not- help. I thought the problem came from an internal inconsistency of gradle that was caused by some sloppy automatic upgrade. But .... this was not the reason.
I had a windows update the day before. Somehow Windows had broken permissions for file creation. Manually adding permission also did not help.
I then tried what always helps in Bill Gates wonderland. Restarted the PC. After that again started Android Studio. It then worked like a charm. Since i did delete the cache file before i am not 100% sure that just rebooting windows would have solved the problem.