Could not initialize class com.android.build.gradle.internal.TaskManager

Hey Team,

I am trying to Setup the react-native in my local system. Following the documentation to setup.

I am just following official documents provided by react native there is some information, what setup I did

  • Node and openjdk8 installed using chocolatly
  • jdk-8u11 is installed and JAVA_HOME environment path is set for the same
  • android SDK platform 29 is present
  • ANDROID_HOME environment variable is set for SDK
  • running project by npx react-native start and npx react-native run-android

Now, When i try to run this command npx react-native run-android, Its giving the below error. I really don’t know why this build failure is happening, I have Googled it but could not reach on the solution. I’m new in react-native.

error Failed to install the app. Make sure you have the Android development environment set up: Setting up the development environment · React Native.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘D:\Dollarbird\KoustavPixel\android\app\build.gradle’ line: 1

  • What went wrong:
    A problem occurred evaluating project ‘:app’.
    Could not initialize class com.android.build.gradle.internal.TaskManager

Thanks & Regards,
Koustav