react-native: could not find com.facebook.react:react-android:0.71.3

New Version

0.61.4

Old Version

0.71.3

Build Target(s)

android

Output of react-native info

System: OS: macOS 12.2 CPU: (8) arm64 Apple M1 Memory: 95.97 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.19.0 - /opt/homebrew/opt/node@16/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.19.3 - /opt/homebrew/opt/node@16/bin/npm Watchman: 2022.11.07.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 18.0.1.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.3 => 0.71.3 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Issue and Reproduction Steps

react-native run-android Output:

  • What went wrong: Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Could not resolve all task dependencies for configuration ‘:app:debugCompileClasspath’. Could not find com.facebook.react:react-android:0.71.3. Required by: project

About this issue

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

Most upvoted comments

After removing ththe following in android/build.gradle it worked:

...
exclusiveContent {
               filter {
                   includeGroup "com.facebook.react"
               }
               forRepository {
                   maven {
                       url "$rootDir/../node_modules/react-native/android"
                   }
               }
        }
        ...

Removing this part also makes the project build (until other errors pop up) with 0.71.3

apply plugin: “com.facebook.react”

add this in your build.gradle/app

Asking again, can we get a reproducer?

I’m closing this as we couldn’t get a reproducer from anyone. This is not an issue in React Native core but in some library. Without a repro we can’t even provide workarounds.

I was able to reproduce after copying and pasting the provided files into a new npx react-native init AwesomeProject --version=0.71.3 project.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find com.facebook.react:react-android:0.71.3.
     Required by:
         project :app
   > Could not find com.facebook.react:hermes-android:0.71.3.
     Required by:
         project :app

This force command in android/build.gradle seems to be forcing the use of 0.71.3 but it doesn’t exist at maven repo:

allprojects {
    configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }
    ...

After commenting only the force line, it took from the version https://mvnrepository.com/artifact/com.facebook.react/react-native/0.71.0-rc.0 and finished building!

Adding this line in settings.gradle solved build issues

includeBuild('../node_modules/@react-native/gradle-plugin')

@nicks258 for my case I am using a prebuild expo app with expo version 48.0.16 and reactnative version 0.71.7 I commented this line out allprojects { configurations.all { resolutionStrategy { // force “com.facebook.react:react-native:” + REACT_NATIVE_VERSION } } and did this apply plugin: “com.facebook.react”

add this in your build.gradle/app

After version 0.71.0, the local mode is no longer available. The global dependent version needs to be replaced online to ensure that all dependent versions are uniform

I am also facing same issue @SharvanTech5

After updating react-native 0.73 and gradle 8.3, I received the following error Could not find com.facebook.react:react-native:0.73.5

and I solved this by applying step by step from the link below as some friends explained, this error is also Plugin with id ‘com.facebook.react’ not found. It solves this too.

https://reactnative.dev/docs/next/integration-with-existing-apps?package-manager=yarn#adding-react-native-to-your-app


Note: After the update, you will definitely have missing files in the following files that are compatible with the new version: build.gradle, app/build.gradle, gradle.properties, settings.gradle, et… *.gradle

@sebas21 have you solved it? I also tried everything but nothing solves the problem.

After removing ththe following in android/build.gradle it worked:

...
exclusiveContent {
               filter {
                   includeGroup "com.facebook.react"
               }
               forRepository {
                   maven {
                       url "$rootDir/../node_modules/react-native/android"
                   }
               }
        }
        ...

Removing this part also makes the project build (until other errors pop up) with 0.71.3

This worked for me also, thanks. There is only a README.md file in that directory $rootDir/../node_modules/react-native/android hence why the not found errors.

“Starting from React Native 0.71, we’re not shipping the /android folder inside the React Native NPM package anymore due to sizing constraints on NPM. The Android artifacts are distributed via Maven Central.” https://github.com/facebook/react-native/tree/main/android.

I was upgrading to “react-native”: “^0.72.0”.

For me the issue was that for some reason react-native was not including the gradle plugin as a dependency. Was missing in my yarn.lock.

Manually adding yarn add react-native-gradle-plugin and yarn build and then editing settings.gradle file by adding this line:

includeBuild(‘…/node_modules/react-native-gradle-plugin’)

seemed to fix.

More info here: https://reactnative.dev/docs/next/integration-with-existing-apps?package-manager=yarn#adding-react-native-to-your-app

Might be unrelated, but I had the same problem when upgrading my app from RN 0.68 to 0.71. In the end, I found out that my package.json still contained a reference to "react-native-gradle-plugin": "^0.0.7". Removing that line solved the issue for me.