1

I am new in react native facing some issues

Starting a Gradle Daemon, 1 busy and 1 incompatible and 1 stopped Daemons could not be reused, use --status for details

Task :app:compileDebugJavaWithJavac FAILED 15 actionable tasks: 2 executed, 13 up-to-date

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

Could not create service of type DefaultGeneralCompileCaches using GradleScopeCompileServices.createGeneralCompileCaches(). Unexpected lock protocol found in lock file. Expected 3, found 0.

  • 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 3m 21s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

Could not create service of type DefaultGeneralCompileCaches using GradleScopeCompileServices.createGeneralCompileCaches(). Unexpected lock protocol found in lock file. Expected 3, found 0.

  • 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 3m 21s

at makeError (C:\Users\RDX\Desktop\AwesomeProject\node_modules\execa\index.js:174:9)
at C:\Users\RDX\Desktop\AwesomeProject\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (C:\Users\RDX\Desktop\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\RDX\Desktop\AwesomeProject\node_modules\@react-native-community\cli\build\index.js:186:9)

info Run CLI with --verbose flag for more details.

1 Answer 1

3

More information is needed here but you can try the following quick fixes.

Please note that the below terminal commands are based on Mac and Linux operating systems.

Run npx react-native run-android after each command below to see which fix works for you.

FIX-1:: Clean stale build & start a fresh one

  cd ./android && ./gradlew clean && cd ..

FIX-2:: Re-install project packages

  rm -rf ./node_modules
  npm install or yarn install

FIX-3:: Update your Gradle (Gradle is an android build system).

  1. Run this command again,

      cd ./android && ./gradlew clean && cd ..
    
  2. Update distributionUrl on android/gradle/wrapper/gradle-wrapper.properties to,

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
  1. Update gradle tools version on android/build.gradle

    buildscript {
      ...
      dependencies {
          ...
          classpath('com.android.tools.build:gradle:4.2.0') // Use this verison
    

NOTE: Each command above should be executed from the project root folder. If none of these works then please leave a comment!

2
  • Where did you take this command from "rm"? It doesn't recognize it
    – showtime
    Commented Dec 10, 2022 at 21:44
  • It is a built-in Terminal command in Mac and Linux. Not sure if it works in Windows.
    – Alish Giri
    Commented Dec 11, 2022 at 6:10

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.