Android Studio 编译问题“该进程无法访问该文件,因为它正被另一个进程使用."

编程入门 行业动态 更新时间:2024-10-28 05:22:10
本文介绍了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 编译问题“该进程无法访问该文件,因为它正被另一个进程使用."

本文发布于:2023-11-10 05:58:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574534.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进程   因为它   该文件   无法访问   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!