Could not create parent directory for lock file

前端 未结 6 1482
执念已碎
执念已碎 2021-01-15 12:58

Error: Failed to complete Gradle execution.

Cause:

Could not create parent directory for lock file C:\\Program Files\\Android\\Android Stu

6条回答
  •  逝去的感伤
    2021-01-15 13:46

    I just ran into this. In my case, the issue appears to have been caused by using the "Use gradle 'wrapper' task configuration" option in Android Studio/IntelliJ. As this answer suggests, this option causes IntelliJ to override the Gradle wrapper task. The solution for me was to select "Use default gradle wrapper (recommended)" instead.

    My suspicion is that this caused a conflict with my customized GRADLE_USER_HOME environment variable for the directory where the final wrapper files actually get stored. For example, Gradle was trying (and failing) to create C:\ProgramData\chocolatey\lib\gradle\tools\gradle-4.5.1\wrapper\dists\gradle-4.5.1-all\87kuriyahurjjkki3zii366f2\gradle-4.5.1-all.zip.lck when run through IntelliJ, but my system uses the file C:\work\.gradle\wrapper\dists\gradle-4.5.1-all\87kuriyahurjjkki3zii366f2\gradle-4.5.1-all.zip.lck when working correctly.

    Switching and then running the Gradle refresh through IntelliJ seems to have fixed it. It also succeeds when I switch back to "Use gradle 'wrapper' task configuration", now.

提交回复
热议问题