0

Configure project :react-native-mmkv [react-native-mmkv] Thank you for using react-native-mmkv ?? [react-native-mmkv] If you enjoy using react-native-mmkv, please consider sponsoring this project: https://github.com/sponsors/mrousavy 13 actionable tasks: 3 executed, 10 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':react-native-reanimated'.

Could not load compiled classes for build file 'C:\Users\rd273\Desktop\dfc-mobile-app-v2\node_modules\react-native-reanimated\android\build.gradle' from cache.

  • 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.

BUILD FAILED in 2s error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDevdebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':react-native-reanimated'. > Could not load compiled classes for build file 'C:\Users\rd273\Desktop\dfc-mobile-app-v2\node_modules\react-native-reanimated\android\build.gradle' from cache. * 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. BUILD FAILED in 2s. info Run CLI with --verbose flag for more details. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.enter image description here

What I tried :-

I tried to clean all the caches and node_modules then tried to build but it is failing to build, even the gradlew clean is also failing to build. The app was running before successfully but after pushing my changes I pulled changes from main branch and it had some changes for shifting to previous version(from 8.10 to 8.7) for gradle as latest one was causing some issues in our App, then it started failing to build!

1 Answer 1

1

I tried the below commands, which are for clearing local/global caches for android and gradle, which worked for me and I think would work for everyone having the same issue/error while building the react native android app :-

  • Remove and Reinstall Android Build Files :-

    1. rm -rf android/app/build
    2. rm -rf android/.gradle
    3. rm -rf android/.idea
  • Clear Gradle Cache Manually :-

    If the above steps don't work, manually delete the Gradle cache:- Linux:

    1. rm -rf ~/.gradle/caches
    2. rm -rf ~/.gradle/daemon
    3. rm -rf ~/.gradle/native
    4. rm -rf ~/.gradle/wrapper OR
  • Command Prompt:

    1. rd /s /q %USERPROFILE%.gradle\caches
    2. rd /s /q %USERPROFILE%.gradle\daemon
    3. rd /s /q %USERPROFILE%.gradle\native
    4. rd /s /q %USERPROFILE%.gradle\wrapper
  1. Delete node_modules :-

    rm -rf node_modules

  2. Clear Yarn Cache:-

    yarn cache clean

  3. Install npm packages :-

    yarn OR npm install

  4. Start the server and run android with the commands used.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.