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-icons
和react-native-elements
,然后app就运行不起来了。尝试npm uninstall
并且删掉了安装react-native-vector-icons
时新增的一些字体文件和图片等,但还是不行。出现上述的错误。
解决办法
看了一些方法,都说需要在Android Studio中clean project
,但我的AS中Build
选项中就是没有clean project
。
于是手动删除了android>app>build>generated>source>r
文件夹。然后再重新run就成功了。