Android Studio:R.jar:该进程无法访问该文件,因为它正在被另一个进程使用

2024-03-01

全新安装Android Studio 3.6.3(便携式)后。当我尝试构建和运行我的项目时,我不断得到

应用\构建\中间体\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar: 该进程无法访问该文件,因为该文件正在被另一个进程使用 过程。

不确定它想从我这里得到什么。我“以管理员身份”运行 Android Studio,甚至关闭项目并重新打开它,第一次运行时,第二次出现错误。

我尝试使缓存无效并重新启动,我尝试删除 app/build 下的文件夹,但它似乎又回来了。我缺少什么?

Thanks

Update:

当尝试清理项目时,我得到以下信息

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:clean'.
> Unable to delete directory 'C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build'
    Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
    - C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar
    - C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug
    - C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar
    - C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build\intermediates

如果我等待几分钟,例如,我更新这个问题所花费的时间,那么它会再次起作用......

update:更新到Android Studio 4,也出现同样的问题。


Try

taskkill /im java.exe /f 

在 cmd 中(Windows 10)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android Studio:R.jar:该进程无法访问该文件,因为它正在被另一个进程使用 的相关文章

随机推荐