Upgraded react native version
Asked Answered
M

3

7

After upgrading my react native version from 0.63.3 to latest version, I am getting the following errors:

> Could not resolve all files for configuration ':classpath'.
   > Could not find com.facebook.react:react-native-gradle-plugin:.
     Required by:
         project :

Following are the dependencies in my build.gradle file:

   dependencies {
        classpath("com.android.tools.build:gradle:7.0.4")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:4.1.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

Would anyone be able to explain this to me? It would be greatly appreciated if you could help!

Mima answered 12/4, 2022 at 3:47 Comment(0)
E
10

The github issue that @RamaProg suggested does provide some insight but it was in the context of building react-native from source. And i believe that issue was created before 0.68.1 was a stable public release.

Following the upgrade guide here: https://react-native-community.github.io/upgrade-helper/?from=0.67.4&to=0.68.1

Suggests the following addititons to settings.gradle:

includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
    include(":ReactAndroid")
    project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
}

And this change is what resolved the issue for me.

Eft answered 19/4, 2022 at 21:30 Comment(0)
G
3

I got this issue recently after upgrading to v68+. It was fixed when I added react-native-gradle-plugin package manually.

yarn add react-native-gradle-plugin

This package was not included in upgrade helper.

Gravitative answered 1/6, 2022 at 10:13 Comment(0)
S
2

According to this RN issue: https://github.com/facebook/react-native/issues/33067

You issue might get fixed by going to your settings.gradle and replacing:

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

with:

includeBuild('../node_modules/react-native/packages/react-native-gradle-plugin') {
    dependencySubstitution {
        substitute(module("com.facebook.react:react-native-gradle-plugin")).using(project(":"))
    }
}

The problem is that you're using an older revision of the repo, therefore the wiki is updated to use the latest main. Building from source from different revision is generally not supported (i.e. you're on your own) as there are those kinds of incompatibilities, and we can't provide instructions for all the possible RN versions/branches.

Shalna answered 12/4, 2022 at 4:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.