react-native run-android报错

之前项目在VScode里运行时没有任何问题,但是隔天再次打开时候报错了,报错如下

> Task :app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture snapshot of output files for task ':app:processDebugResources' property 'sourceOutputDir' during up-to-date check.
> Could not read path 'D:\ReactNativeProject\MyApp\android\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\com\facebook\imagepipeline\backends'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

经过查询后知道如何解决,按照下面的方法就可解决

//在项目的路径下输入
PS D:\ReactNativeProject\MyApp> cd android
PS D:\ReactNativeProject\MyApp\android> ./gradlew clean

//等待加载完后,回到上一层目录,执行react-native run-android。
PS D:\ReactNativeProject\MyApp\android> cd ..
PS D:\ReactNativeProject\MyApp> react-native run-android

问题解决

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^