Error running "React-Native run-android": Execution failed for task ':app:processDebugResources'

Asked

Viewed 447 times

1

After I install some libraries from React-Native-navigation for a project, I executed the command react-native run-android cmd but it closes my server and returns the error below. How can I resolve this?

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
  > Unable to delete directory 'C:\UsersRafael\DevPost\android\app\build\generated\not_namespaced_r_class_sources\debug\r\androidx\arch' after 10 attempts

Esse é o erro que aparece

  • Try deleting the node_modules folder and run npm i

1 answer

1


It is relatively common for Android build errors to occur after installing a library. This occurs if you modify some file within the directory /android or if React Native performs the link of that library.

For example, the cited library (React-Native-navigation) has native code, so consequently React Native needs to perform the link so that this library can be used. It is worth mentioning that starting from version v0.60 this link is performed automatically (in most cases).

When this type of error occurs, clear the Android build with the gradlew clean. This command will make all the contents of the directory build is deleted (see documentation), which is the task that the react-native run-android failed to accomplish (emphasis on error message Unable to delete directory ...\build\...).

To accomplish the gradlew clean, just go to the directory of android and execute the command:

cd android
./gradlew clean

And then try to start the project again. This will cause Gradle to do the whole build process again, taking a little longer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.