Android Studio 编译问题“该进程无法访问该文件,因为它正被另一个进程使用." [英] Android Studio problem with compiling "The process cannot access the file because it is being used by another process."

查看:57
本文介绍了Android Studio 编译问题“该进程无法访问该文件,因为它正被另一个进程使用."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题以前有人问过,但是没有一个满意的答案,最后一个帖子是三年前的.我在 Windows 10 中使用 android studio 3.6.2.每次我尝试编译我的程序时,我都会收到错误消息该进程无法访问该文件,因为它正被另一个进程使用."

I know this question has been asked before, but there wasn't a satisfactory answer, and the last post was three years ago. I am using android studio 3.6.2 in windows 10. Every time I try to compile my program I get the error "The process cannot access the file because it is being used by another process."

现在我知道是什么导致了错误.之前编译的 R.jar 文件无法删除,因为 android studio 正在锁定文件.它位于文件夹 appuildintermediatescompile_and_runtime_not_namespaced_r_class_jardebug

Now I know what is causing the error. The R.jar file that was previously compiled cannot be deleted because android studio is locking the file. It is in a folder appuildintermediatescompile_and_runtime_not_namespaced_r_class_jardebug

现在为了解决这个问题,我一直在关闭 android studio.然后删除R.jar,然后重启android studio然后编译.这个过程需要几分钟的时间,我每次都必须这样做.想象一下,当你每次都必须这样做时,编写一个程序需要多长时间.

Now to get around the problem I have been closing down android studio. Then deleting the R.jar, then restarting android studio and then compiling. This process takes a good few minutes and I have to do it every time. Imagine how long it takes to write a program when you have to do this every time.

当在堆栈溢出时询问此问题时,以前的建议是无效缓存/重新启动,但这并不比我上面所做的更快,并且只能工作一次.也试过 Clean Project,但没有效果.

When this was asked on stack overflow previously suggestions were to Invalid caches / restart, but that is no quicker than what I did above, and only works once. Also tried Clean Project, but that has no effect.

这些年来我使用了很多编译器,比如visual studio、codeblocks 等,但这种事情以前从未发生过,那么为什么android studio 如此糟糕?有没有人找到解决这个问题的方法?

I have used many compilers over the years like visual studio, codeblocks etc but this kind of thing never happened before, so why is android studio so bad? Has anyone found a solution to this problem yet?

推荐答案

[][]

在每次启动之前,转到编辑配置"检查您是否没有构建.删除构建"

Go to Edit Configurations check that you are not building before each launch. Remove "Build"

这篇关于Android Studio 编译问题“该进程无法访问该文件,因为它正被另一个进程使用."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆