Android Studio :app:processDebugResources FAILED

Win10中使用CMD运行react-native run-android命令出现以下错误:

:app:processDebugResources FAILED 

FAILURE: Build failed with an exception. 
* What went wrong: Execution failed for task ':app:processDebugResources'. 
> java.io.IOException: Could not delete path 
'F:\myProjects\reactNativeProjects\TestProject\android\app\build\generated\source\r\debug\com'.

在VS Code中使用React Native Tools运行时报以下错误:

:app:processDebugResources FAILED
 ERROR  EPERM: operation not permitted, lstat 'f:\myProjects\reactNativeProjects\TestProject\android\app\build\generated\source\r\debug\com\oblador\vectoricons\R.java'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"f:\\myProjects\\reactNativeProjects\\TestProject\\android\\app\\build\\generated\\source\\r\\debug\\com\\oblador\\vectoricons\\R.java"}
Error: EPERM: operation not permitted, lstat 'f:\myProjects\reactNativeProjects\TestProject\android\app\build\generated\source\r\debug\com\oblador\vectoricons\R.java'

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> java.io.IOException: Could not delete path 'F:\myProjects\reactNativeProjects\TestProject\android\app\build\generated\source\r\debug\com\oblador'.

之前安装了UI组件react-native-vector-iconsreact-native-elements,然后app就运行不起来了。尝试npm uninstall并且删掉了安装react-native-vector-icons时新增的一些字体文件和图片等,但还是不行。出现上述的错误。

解决办法

看了一些方法,都说需要在Android Studio中clean project,但我的AS中Build选项中就是没有clean project

于是手动删除了android>app>build>generated>source>r文件夹。然后再重新run就成功了。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容