Failed to capture snapshot of output files for task ':app:processDebugResources' property 'sourceOutputDir' during up-to-date check

Viewed 4761

I'm working on Windows 10 and just starting with react-native. from https://facebook.github.io/react-native/docs/getting-started

One of the first steps to get started is to run: react-native run-android. But I'm getting this error:

enter image description here

Starting JS server... Building and installing the app on the device (cd android && gradlew.bat installDebug)... Starting a Gradle Daemon (subsequent builds will be faster)

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 'C:\Users\Kourosh\Desktop\React Native\AwesomeProject\android\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\android\arch\lifecycle\livedata\core'.

3 Answers

If this happens after changing your styles.xml in android/app/src/main/res/values, run this:

cd android
./gradlew clean
cd ..
react-native run-android

Source (Github issue comment)

Clearing the cache does fix it. But only once, if you stop the project and re run it, you ll end up with same error again.

Doing following fixes it for me,

cd android
./gradlew clean
react-native start --reset-cache
npm clean cache --force

Next, open two different terminals run

react-native start

in one and in second run

react-native run-android

Hope it'll work for you as well.

So, if you have an Ionic 4 project, into your project folder, go to platforms/android and run ./gradlew clean.

cd platforms/android
./gradlew clean
ionic cordova run android -l
Related