react-native: Newer React-Native Version 0.71.0 not running

Description

When I am running newly build project it gives me these errors:

`FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\malik.usman\Desktop\Malik Usman\React Native Projects\MyApp\android\app\build.gradle' line: 2

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find implementation class 'com.facebook.react.ReactPlugin' for plugin 'com.facebook.react' specified in jar:file:/C:/Users/malik.usman/.gradle/caches/jars-9/20363358361f313985ae969d544ea93f/react-native-gradle-plugin.jar!/META-INF/gradle-plugins/com.facebook.react.properties.

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle

* 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 13s

Version

0.71.0

Output of npx react-native info

info Fetching system and libraries information… error Unable to print environment info. Error: Command failed: wmic os get Caption ‘wmic’ is not recognized as an internal or external command, operable program or batch file.

Steps to reproduce

When I am building my react-native project through command prompt, I am running this line npx react-native run-android.

Snack, code example, screenshot, or link to a repository

npx react-native run-android

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 30 (4 by maintainers)

Most upvoted comments

Don’t know how but I just solved it, by deleting the node_modules folder of my project and then re-running the project, it worked perfectly fine. Lastly thank you all for your involvement.

@cortinico

I have resolved this with simple solution

just do rm -rf node_modules then do yarn install after that it will work

For this to work, you need to delete the “node_modules” folder and the android/.gradle file, and finally, you need to do a “npm i” and a ./gradlew clean in the android folder.

Deleting “.gradle” and “node_modules” folders worked for me. Thanks to all 👍👍👍

delete android/.gradle and node_modules and again run npm I and run android command it will work fine!