Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
547 views
in Technique[技术] by (71.8m points)

android - Android更新导致错误:错误:java.nio.file.AccessDeniedException:/home/path/.android/build-cache.lock(Android update causing error: Error:java.nio.file.AccessDeniedException: /home/path/.android/build-cache.lock)

Updated Android Studio from version 2.3 to 3.1 Canary.

(将Android Studio从版本2.3更新到了Canary 3.1。)

But there seems to be a huge problem with Gradle .

(但是Gradle似乎存在很大的问题。)

Error:java.nio.file.AccessDeniedException: /home/pathname/.android/build-cache.lock

(错误:java.nio.file.AccessDeniedException:/ home /路径名/.android/build-cache.lock)

What I did:

(我做了什么:)

  1. Deleted .gradle , thought it will solve the issue, but not, after rebuilding the project, .gradle again appears.

    (删除了.gradle ,以为它可以解决问题,但是在重建项目后, .gradle再次出现。)

  2. Deleted all android related things from system (SDK, Android Studio and remaining projects) and from zero started to download Android Studio with all required packages.

    (从系统(SDK,Android Studio和其余项目)中删除了所有与android相关的东西,并从零开始下载具有所有必需软件包的Android Studio。)

    Still, the same problem.

    (仍然,同样的问题。)

  3. Changed android studio version from 3.1 canary to 3.0, also no success.

    (android studio版本从3.1 canary更改为3.0,也没有成功。)

  4. Looked at this post , but didnt help.

    (看了这篇文章 ,但没有帮助。)

  5. Read in some posts that this happens when Android Studio is corrupted.

    (阅读一些文章,指出Android Studio损坏时会发生这种情况。)

    but I have downloaded from official site.

    (但是我已经从官方网站下载了。)

Any ideas how to fix it?

(任何想法如何解决?)

  ask by Zafar Kurbonov translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I got the same error trying to Sync the project after an update.

(更新后尝试同步项目时出现相同的错误。)

What solved the problem was giving the right permission to the .android folder, instead of running the studio on root mode (It would reinstall all SDK under root if you don't specify that you already have it under you user).

(解决该问题的方法是为.android文件夹提供正确的权限,而不是以root模式运行studio(如果您未指定用户已经拥有它,它将在root用户下重新安装所有SDK)。)

So, open the terminal and type:

(因此,打开终端并输入:)

sudo chown -R root:YOURUSERNAME /home/YOURUSERNAME_FOLDER/.android/
sudo chmod -R 775 /home/YOURUSERNAME_FOLDER/.android/

Easy fix, I hope it helps somebody.

(易于修复,希望对您有所帮助。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...