The build error looks something like this:
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
- What went wrong:
A problem occurred configuring root project ‘My Project’.
Could not determine the dependencies of null.
Could not resolve all task dependencies for configuration ‘:classpath’.Could not resolve com.facebook.react:react-native:+.
Required by:
project :
No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found.
The consumer was configured to find a runtime of a library compatible with Java 11,
packaged as a jar, and its dependencies declared externally, as well
as attribute ‘org.gradle.plugin.api-version’ with value ‘7.3.3’
3
Answers
FIX INSIDE
Steps to resolve the react-native issue that we are facing since couple of days.
Note: This issue occurred because of the new release of the react native(4th nov), here I'm attaching the link for the reference.
URL : https://github.com/facebook/react-native/issues/35210
(if you face any issues do let me know i'll help you in resolving the same.)
update this below content in project level build.gradle:
it’s working for me
This fix works:
Reason for Failures : The build failures for Android was due to the publish of the React Native version 0.71.0-rc0 to Maven and because of which when the gradle is syncing its picking this 0.71.0-rc0 version of react-native rather then your current version of react-native.
Made it work without upgrading react-native version and by adding this in build.gradle, this works (hermes enabled or not, along with flipper too)
final snippet looks like this
gradle clean and rebuild after this fix. Then you can react native run android successfully.
What this fix will do is apply an
exclusiveContent
resolution rule that will force the resolution of React Native Android library, to use the one insidenode_modules
If you dont want to put this fix, you can update your react native version for the project to the react native patch version as mentioned here
https://github.com/facebook/react-native/issues/35210