1

I am upgrading a React Native project to RN 0.76.7. However, I keep this error when I run ./gradlew build: "Could not find com.facebook.react:react-native:0.76.7".

The full text of the error is:

Could not determine the dependencies of task ':react-native-async-storage_async-storage:extractDebugAnnotations'.
> Could not resolve all dependencies for configuration ':react-native-async-storage_async-storage:debugCompileClasspath'.
   > Could not find com.facebook.react:react-native:0.76.7.
     Required by:
         project :react-native-async-storage_async-storage

Here are the contents of my android/build.gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "35.0.0"
        minSdkVersion = 24
        compileSdkVersion = 35
        targetSdkVersion = 34
        kotlinVersion = "1.9.25"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath('com.facebook.react:react-native-gradle-plugin')
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
    }
}

// apply plugin: "com.facebook.react.rootproject"
// apply plugin: "com.facebook.react"

allprojects {
    repositories {    
        mavenLocal()
        mavenCentral()
        google()
        maven { url 'https://www.jitpack.io' }
    }

    def REACT_NATIVE_VERSION = "0.76.7" // Manually specify the version

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

Some things I've tried:

  • using the commented apply plugin: "com.facebook.react.rootproject:, which gives error "Failed to apply plugin 'com.facebook.react.rootproject'."
  • commenting out the configurations.all block entirely, which gives the error "Could not find any matches for com.facebook.react:react-native:+"
  • confirming that I have RN 0.76.7 installed in my package.json
  • ./gradlew clean
  • reading https://reactnative.dev/docs/troubleshooting
  • checking what android versions I have installed (android-31, android-34-ext8, android-35)

I'm unsure what could be causing this error because it was working fine before the upgrade. If there's any additional information that would help I'd be happy to share.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.